<?php
$bt="删除用户日记";
include("../conn.php");
include("../head.php");
include("../function.php");

$sid = sqlstr($_COOKIE['dl']);
$uin=mysql_fetch_array(mysql_query("select * from user where sid='$sid'"));
$uid=$uin['id'];
if(!$uin){
header("Location:../login.php");
exit;//没登录就跳转到登录页面
}


$id=$_GET["id"];

$user=mysql_fetch_array(mysql_query("select * from user where id='$id'"));
$name=$user["name"];

$admin=$_GET["admin"];
if($uid!=1){
header("Location:/m/diary/index.php");
exit;//自己的id就回到首页
}

if($admin=="1"){
mysql_query("DELETE FROM diary WHERE diarywriteid='$id'");
echo "<br/><br/>删除成功啦<br/><a href='diary.php'>返回</a><br/><br/><br/>";
}else{

echo "<br/>你确定删除".$name."的日记？<br/> <br/><a href='diary.php'>返回</a><br/> <br/><a href='diaryadmin.php?id=".$id."&admin=1'>确定删除</a><br/><br/><br/>";
}

echo '
<br/><br/>输入ID：<br/>
<form action="diaryadmin.php" method="GET">

<input name="id" type="text"><br/><br/>

<input class="libbtn" type="submit" value="删除" />　　<a href="/m/adm.php">返回>></a></form><br/><br/>';


?>
<div id="libbottom" class="ll"><a href="../out.php">登出</a> | <a href="../about.php">关于印象</a><br />浏览：<a href="/">桌面版(开发中)</a><br /><?php echo $showtime=date("m月d日 H:i:s");?><br />© 2013 一线印象</div>
