<?php include("dh.php"); 
include("../sql/conn.php");
include("yz.php"); 
$llym = $_SERVER["HTTP_REFERER"];
?>

<?php
if ($_GET['s']=="ok")
{
mysql_query("DELETE FROM msn1 WHERE id='".$_GET['id']."'");

mysql_query("INSERT INTO text (name, time, ip, ing, f, bz) 
VALUES ('".$_SESSION['name']."', '".$noww."', '".$iipp."', '信件删除".$_GET['id']."', '0', '')");
?>
<script language="javascript">setTimeout(function (){location.href='<?php echo $llym; ?>';},2);</script>
<?
}

?>

<?php

if($_GET['ys'])
{
$ys = $_SESSION['ts']*($_GET['ys']-1);
}	 
else
{
$ys = 0;
}

if($_GET['px'])
{
$px = $_GET['px'];
}	 
else
{
$px = id;
}

?>

 
 <?php
echo "<TABLE ><TBODY><TR  bgcolor=#CCCC00 >";

  echo "<td><a href=?ys=".$_GET['ys']."&px=gotime>发信时间</a></td>";
  echo "<td><a href=?ys=".$_GET['ys']."&px=nr>内容</a></td>";
  echo "<td><a href=?ys=".$_GET['ys']."&px=go1>来自</a></td>";
  echo "<td><a href=?ys=".$_GET['ys']."&px=to1>写给</a></td>";
  echo "<td><a href=?ys=".$_GET['ys']."&px=yd>已读</a></td>";
  echo "<td>删</td>";
  echo "</TR>";

$result = mysql_query("SELECT * FROM msn1 ORDER  BY ".$px." DESC LIMIT ".$ys.",".$_SESSION['ts']);

while($row = mysql_fetch_array($result))
  {
echo "<TR ";
?> onmouseover="this.style.background='#FFF'; " onmouseout ="this.style.background=''; this.style.borderColor=''" <?php 
echo ">";

$tim = date("m月d日H:i:s",$row['gotime']);
echo "<TD ><textarea  cols=18 rows=1>".$tim. "</textarea></td>";
echo "<TD ><textarea  cols=28 rows=1>".$row['nr'] . "</textarea></td>";
echo "<TD ><textarea  cols=8 rows=1>".$row['go1'] . "</textarea></td>";
echo "<TD ><textarea  cols=8 rows=1>".$row['to1'] . "</textarea></td>";
echo "<TD ><textarea  cols=4 rows=1>".$row['yd'] . "</textarea></td>";

echo "<td><a ";
?>onClick="return confirm('删除要小心！？')"<?php
echo " href=?s=ok&id=".$row['id']." >删</a></td>";

echo "</TR>";
  }
echo "</TBODY></TABLE>";

?>

 
<?php 

$result = mysql_query("SELECT * FROM msn1");//查看总留言数并分页
$num = mysql_num_rows($result);
echo "全部信件".$num."条。";
$ys = ceil($num/$_SESSION['ts']);

for ($i=1; $i<=$ys; $i++)
{
if ($_GET['ys']!=$i)
echo " <a href=?ys=".$i."&px=".$_GET['px'].">".$i."</a> ";
else
echo "<strong>[".$i."]</strong>";

}

echo "</p>";

?> 

<hr>

<textarea cols="88" rows="3">

</textarea>


<?php include("../sql/close.php"); ?>