<?php
//require_once("../global/checkuser2.php");
session_start();
$user=$_SESSION['name'];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>查看邮件</title>
<link rel="stylesheet" href="addmodify.css" />
</head>

<body>
<?php
require_once("../global/connect.php");
$id=$_GET['id'];
$sql=mysql_query("select * from gonggao where id='$id'");
while($row=mysql_fetch_array($sql)){
$send=$row['send'];
$title=$row['title'];
$content=$row['content'];
$date=$row['date'];
}
$next="";
$prev="";
$sql=mysql_query("select max(id) from gonggao where id<'$id'");
while($row=mysql_fetch_array($sql)){
$id1=$row[0];
}
//echo $id;
$sql1=mysql_query("select * from gonggao where id='$id1'");
//$sql1=mysql_query("select * from gonggao where id = (select max(id) from gonggao where id<'$id')");
while($row1=mysql_fetch_array($sql1)){
$next=$row1['id'];
$nextt=$row1['title'];
}
$sql=mysql_query("select min(id) from gonggao where id>'$id'");
while($row=mysql_fetch_array($sql)){
$id2=$row[0];
}
//echo $id;
$sql2=mysql_query("select * from gonggao where id='$id2'");
//$sql2=mysql_query("select * from gonggao where id = (select min(id) from gonggao where id>'$id')");
while($row2=mysql_fetch_array($sql2)){
$prev=$row2['id'];
$prevt=$row2['title'];
}
?>
<form id="deleteform" method="post" action="function.php?mod=deletegg">
<input type="hidden" name="id" value="<?=$_GET[id]?>"/>
</form>
<div class="bigdiv">
<table cellspacing="0" cellpadding="0" style="font-size:14px;"><tr><td style="text-align:left;border-left:none;">您的位置：<a href="receive.php">邮件系统</a>/查看公告</td><td style="text-align:right;border-left:none;"><a href="gonggao.php">返回</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr></table>
<div class="list">
<div class="content">
<table cellspacing="0" cellpadding="0" style="width:100%;">
<tr><td style="width:10%;">发件人：</td><td style="width:89%;border-left:none;color:#666666;text-align:left;"><?=$send?></td></tr>
<tr><td style="width:10%;">时&nbsp;&nbsp;&nbsp;&nbsp;间：</td><td style="width:89%;border-left:none;color:#666666;text-align:left;"><?=$date?></td></tr>
<tr><td style="width:10%;">标&nbsp;&nbsp;&nbsp;&nbsp;题：</td><td style="width:89%;border-left:none;color:#666666;text-align:left;"><?=$title?></td></tr>
<tr><td style="width:10%;">内&nbsp;&nbsp;&nbsp;&nbsp;容：</td><td style="width:89%;border-left:none;color:#666666;text-align:left;background:#FFF;border:1px solid #ccc;"><div style="height:450px;width:100%;overflow:auto"><?=$content?></div></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>&nbsp;</td><td style="text-align:left;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input class="btn" type="button" value="删除" onclick="document.getElementById('deleteform').submit();"/></td></tr>
<tr><td>&nbsp;</td><td style="text-align:center;"><?php
if($prev!=""){
echo "<a href='showgg.php?id=$prev'>上一封:&nbsp;&nbsp;$prevt</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
}
if($next!=""){
echo "<a href='showgg.php?id=$next'>下一封:&nbsp;&nbsp;$nextt</a>";
}
?></td></tr>
</table>
</div>
</div>
</div>
</body>
</html>
