<?php
include('sys.php');
function writetofile($filename,$book)
{
$fd=fopen("$filename","a+");
fwrite($fd,$book);
fclose($fd);
}

if ($password2==$admin){
$filename="gb/id_$id";
unlink("$filename");//删除留言的文件

$list=file("gb/list.php");
$listcount=count($list);
$count--;
unset($list[$count]);
unlink("gb/list.php");
for($i=0;$i<$listcount;$i++)
{
writetofile("gb/list.php",$list[$i]);
}

echo"$filename 删除成功";
echo "<meta http-equiv=Refresh content=1;url=index.php>";
}
else
{
?>
<html>
<head>
<title><?echo"$sitename";?></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="font.css" type="text/css">
<style type="text/css">
<!--
.b {  background-color: #CCCCCC; border: #000000; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px}
-->
</style>
</head>

<body text="#000000" topmargin="2">
<?include('head.php');?>
<table width="760" border="0" cellspacing="0" cellpadding="0" class="font">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<table width="760" border="0" cellspacing="1" cellpadding="2" bgcolor="#000000" class="font" height="39">
  <tr> 
    <td bgcolor="<?echo"$color2";?>" align="center" valign="middle"> 
      <form name="" method="post" action="del.php?count=<?echo "$count";?>&id=<? echo "$id";?>">
        <p>删除留言<br>
          管理员密码 
          <input type="password" name="password2" value="" >
          <input type="submit" name="Submit3" value="提交" >
        </p>
      </form>
    </td>
  </tr>
</table>
<?include('copyright.php');?>
</center>
</body>
</html>
<?
}?>
