function del_comment($id) { $sql = 'SELECT `id` FROM `' . DB_PREFIX . DB_TBL_COMMENTS . '` WHERE `parent` = ' . $id; $sql = mysql_query($sql); if (false == $sql) { my_die(); } $aChilds = array(); while ($row = mysql_fetch_assoc($sql)) { $aChilds[] = current($row); } foreach ($aChilds as $v) { del_comment($v); } $sql = "DELETE FROM `" . DB_PREFIX . DB_TBL_COMMENTS . "` WHERE `id` = " . $id; $sql = mysql_query($sql); if (false == $sql) { my_die(); } }
<?php require "../includes/config.php"; if (!isset($_POST["del_comm_id"])) { apologize("Comment not specified."); } session_start(); if (del_comment($_POST["del_comm_id"], $_GET["soc"], $_POST["del_comm_reason"]) === false) { apologize("Something went wrong."); } redirect("post.php?soc=" . $_GET["soc"] . "&pid=" . $_GET["pid"]);
<?php include 'functions.php'; session_start(); check_valid_user(); $id = $_GET['id']; $result = del_comment($id); if ($result) { echo "Delete comment successfully."; } else { echo "Fail to delete comment."; }
return ajax_echo('no method:' . $f); } } if ($f = _get('l')) { if ($f != 'addarticle') { addarticle(); } if (function_exists($f)) { call_user_func($f); } else { return ajax_echo('no method:' . $f); } } if ($f = _get('m')) { if ($f != 'del_comment') { del_comment(); } if (function_exists($f)) { call_user_func($f); } else { return ajax_echo('no method:' . $f); } } if ($f = _get('n')) { if ($f != 'del_user') { del_user(); } if (function_exists($f)) { call_user_func($f); } else { return ajax_echo('no method:' . $f);
showcontent($id, $page); break; case "write_review": write_review(); break; case "preview_review": preview_review($date, $title, $text, $reviewer, $email, $score, $cover, $url, $url_title, $hits, $id, $rlanguage); break; case "" . _YES . "": send_review($date, $title, $text, $reviewer, $email, $score, $cover, $url, $url_title, $hits, $id, $rlanguage); break; case "del_review": del_review($id_del); break; case "mod_review": mod_review($id); break; case "postcomment": postcomment($id, $title); break; case "savecomment": savecomment($xanonpost, $uname, $id, $score, $comments); break; case "del_comment": del_comment($cid, $id); break; default: reviews_index(); break; } }