📄 21-13.php
字号:
<?php
echo "<html>\n"; //输出标准HTML内容
echo "<head>\n";
echo "<title>\n";
echo "删除贴子\n";
echo "</title>\n";
echo "</head>\n";
echo "<body>\n";
echo "<link href=\"style.css\" rel=\"stylesheet\" type=\"text/css\">\n";
echo "<div class=\"Frame\">\n";
if(!$_GET[id])
{
echo "<div class=\"title\">没有指定删除ID<p>点<a href=\"21-5.php\">这里</a>返回</div>";
}
else
{
include "21-1.php";
$sql="select power from $bbs_user where name='$_COOKIE[user]'";
$temp=mysql_fetch_array(mysql_query($sql,$my_conn));
if($temp[0]!=2)
{
echo "<div class=\"title\">你不是系统管理员<p>无权对此贴子进行删除<p>点<a href=\"21-5.php\">这里</a>返回</div>";
exit();
}
else
{
if(!$_POST[action])
{
echo "
<script language=\"javascript\">
<!--
function Juge(theForm)
{
if (confirm(\"再次对删除进行最终确认\"))
{
return (true);
}
else
{
return (false);
}
}
-->
</script>\n";
echo "<div class=\"title\">删除贴子</div>\n";
echo "<div class=\"main\"> </div>\n\n";
echo "<form name=\"f\" action=\"".$_SERVER[PHP_SELF]."?id=".$_GET[id]."\" method=\"post\" onsubmit=\"return Juge(this)\">\n";
echo "<div class=\"title\">你确认要删除编号为:".$_GET[id]."的贴子吗</div>";
echo "<div class=\"title\">如果贴子为主题,则主题将被标记为删除状态</div>";
echo "<div class=\"title\"><input type=\"submit\" name=\"action\" value=\"确认删除\"><input type=\"button\" value=\"返回上页\" onclick=\"history.go(-1)\"></div>\n";
echo "</form>\n";
}
else
{
$id=$_GET[id];
$sql="select type_id,re_id,poster_id from $bbs_post where id='$id' limit 1";
$temp=mysql_fetch_array(mysql_query($sql,$my_conn));
if($temp[1]==0)
{
$sql2="update $bbs_post set content='此贴已经删除' ,poster_id=0 where id='$id'";
$result=mysql_query($sql2,$my_conn);
}
else
{
$sql2="update $bbs_type set p_count=p_count-1 where id='$temp[0]'";
mysql_query($sql2,$my_conn);
$sql3="update $bbs_user set post_num=post_num-1 where id='$temp[2]'";
mysql_query($sql3,$my_conn);
$sql4="DELETE FROM $bbs_post where id='$id'";
$result=mysql_query($sql4,$my_conn);
}
if($result)
{
echo "<div class=\"title\">删除贴子成功<p>点<a href=\"21-5.php\">这里</a>返回</div>";
}
else
{
echo "<div class=\"title\">删除贴子失败<p>点<a href=\"21-5.php\">这里</a>返回</div>";
}
}
}
}
echo "</div>";
echo "</doby>";
echo "</html>";
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -