⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 delete_comment.php

📁 一个全功能的国外博客商业程序
💻 PHP
字号:
<?
include "header.php";

//SET PRIVACY SETTINGS
if($is_admin_logged_in == "yes") {
$privacy = "AND (privacy='0' OR privacy='1' OR privacy='2' OR privacy='3')";
} elseif($member_info[u_id] == $user_info[u_id]) {
$privacy = "AND (privacy='0' OR privacy='1' OR privacy='2' OR privacy='3')";
} elseif($group_info[allow_members] == "1" & mysql_num_rows(mysql_query("SELECT m_id FROM bhost_members WHERE u_id='$user_info[u_id]' AND member_u_id='$member_info[u_id]'")) == "1") {
$privacy = "AND (privacy='1' OR privacy='2' OR privacy='3')";
} elseif($is_logged_in == "yes") {
$privacy = "AND (privacy='2' OR privacy='3')";
} else {
$privacy = "AND privacy='3'";
}

// IF PRIVACY FEATURE IS DISABLED BY ADMIN
if($group_info[allow_privacy] != 1) {
$privacy = "AND (privacy='0' OR privacy='1' OR privacy='2' OR privacy='3')";
}

if(isset($_POST['task'])) { $task = $_POST['task']; } elseif(isset($_GET['task'])) { $task = $_GET['task']; } else { $task = "main"; }
if(isset($_POST['e_id'])) { $e_id = $_POST['e_id']; } elseif(isset($_GET['e_id'])) { $e_id = $_GET['e_id']; } else { exit(); }
if(isset($_POST['c_id'])) { $c_id = $_POST['c_id']; } elseif(isset($_GET['c_id'])) { $c_id = $_GET['c_id']; } else { exit(); }
if(mysql_num_rows(mysql_query("SELECT e_id FROM bhost_entries WHERE e_id='$e_id' AND u_id='$user_info[u_id]' $privacy")) != 1) { exit(); }
if(mysql_num_rows(mysql_query("SELECT c_id FROM bhost_comments WHERE c_id='$c_id' AND e_id='$e_id' AND u_id='$user_info[u_id]'")) != 1) { exit(); }
$entry_info = mysql_fetch_assoc(mysql_query("SELECT * FROM bhost_entries WHERE e_id='$e_id' AND u_id='$user_info[u_id]' $privacy"));
$comment_info = mysql_fetch_assoc(mysql_query("SELECT * FROM bhost_comments WHERE c_id='$c_id' AND e_id='$e_id' AND u_id='$user_info[u_id]'"));

$is_error = "no";
$error = "";
if($group_info[allow_members] == "1" & $user_info[show_comments] == "1" & $member_info[u_id] != $user_info[u_id] & $is_admin_logged_in != "yes" & ($is_logged_in == "no" | mysql_num_rows(mysql_query("SELECT m_id FROM bhost_members WHERE u_id='$user_info[u_id]' AND member_u_id='$member_info[u_id]'")) != "1")) {
  $is_error = "yes";
  $error = "<b>$delete_comment1</b><br>$delete_comment2 <a href='login.php?u=$user_info[username]&e_id=$e_id&c_id=$c_id&ref=4'>$delete_comment3</a>.";
  $icon = "./images/key.gif";
} elseif($user_info[show_comments] == "2" & $is_logged_in == "no" & $is_admin_logged_in != "yes") {
  $is_error = "yes";
  $error = "<b>$delete_comment1</b><br>$delete_comment4 <a href='login.php?u=$user_info[username]&e_id=$e_id&c_id=$c_id&ref=4'>$delete_comment3</a>.";
  $icon = "./images/key.gif";
} elseif($entry_info[comments] == "0") {
  $is_error = "yes";
  $error = "<b>$delete_comment5</b><br>$delete_comment6";
  $icon = "./images/error.gif";
} elseif($group_info[allow_comments] == "0" | $user_info[show_comments] == "0") { 
  $is_error = "yes"; 
  $error = "<b>$delete_comment5</b><br>$delete_comment7"; 
  $icon = "./images/error.gif";
} elseif(($user_info[manage_comments] == "0" | $user_info[manage_comments] == "1") & $user_info[u_id] != $member_info[u_id] & $is_admin_logged_in != "yes") {
  $is_error = "yes"; 
  $error = "<b>$delete_comment8</b><br>$delete_comment9"; 
  $icon = "./images/error.gif";
} elseif($is_logged_in != "yes" & $is_admin_logged_in != "yes") {
  $is_error = "yes";
  $error = "<b>$delete_comment1</b><br>$delete_comment4 <a href='login.php?u=$user_info[username]&e_id=$e_id&c_id=$c_id&ref=4'>$delete_comment3</a>.";
  $icon = "./images/key.gif";
} elseif($member_info[username] != $comment_info[username] & $user_info[u_id] != $member_info[u_id] & $is_admin_logged_in != "yes") {
  $is_error = "yes"; 
  $error = "<b>$delete_comment1</b><br>$delete_comment10 <a href='login.php?u=$user_info[username]&e_id=$e_id&c_id=$c_id&ref=4'>$delete_comment3</a>"; 
  $icon = "./images/key.gif";
}


if($is_error == "yes") {
echo $head;
echo "
<div class='float' style='padding-right: 2px;'><img src='$icon' border='0'></div>
<div>$error</div>
";
echo $foot;
exit();
}



if($task == "cancel") {
$url = url("entry", "$user_info[username]", "$e_id", "", "", "#c$c_id");
header("Location: $url");
exit();
}


if($task == "dodelete") {
mysql_query("DELETE FROM bhost_comments WHERE c_id='$c_id' AND e_id='$e_id' AND u_id='$user_info[u_id]'");
$url = url("entry", "$user_info[username]", "$e_id");
header("Location: $url");
exit();
}




echo $head;
echo "
<h2>$delete_comment11</h2>
$delete_comment12
<br><br>

<table cellpadding='0' cellspacing='0'>
<tr>
<form action='delete_comment.php' method='POST'>
<td>
<input type='submit' class='button' value='$delete_comment13'>&nbsp;
<input type='hidden' name='task' value='dodelete'>
<input type='hidden' name='u' value='$user_info[username]'>
<input type='hidden' name='e_id' value='$e_id'>
<input type='hidden' name='c_id' value='$c_id'>
</td>
</form>
<form action='delete_comment.php' method='POST'>
<td>
<input type='submit' class='button' value='$delete_comment14'>
<input type='hidden' name='task' value='cancel'>
<input type='hidden' name='u' value='$user_info[username]'>
<input type='hidden' name='e_id' value='$e_id'>
<input type='hidden' name='c_id' value='$c_id'>
</td>
</form>
</tr>
</table>
";
echo $foot;
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -