本文整理匯總了PHP中comments::findComment方法的典型用法代碼示例。如果您正苦於以下問題:PHP comments::findComment方法的具體用法?PHP comments::findComment怎麽用?PHP comments::findComment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類comments
的用法示例。
在下文中一共展示了comments::findComment方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: comments
require_once "models/db.php";
require_once "models/PasswordHash.php";
require_once "models/post.php";
require_once "models/comments.php";
session_start();
if (isset($_SESSION['user'])) {
$user = $_SESSION['user'];
} else {
die;
}
//If a query string exists
if ($_GET) {
//If both of the required fields exist check for the comment to delete
if (isset($_GET['commentid']) && isset($_GET['postid'])) {
$comment = new comments();
$deleteComment = $comment->findComment($dbh, $_GET['commentid']);
//If the comment doesn't exist then die
if (!$deleteComment) {
die;
} else {
//If the comment belongs to the user on this controller or an admin is on this controller delete it
if ($deleteComment->userid == $user->id || $user->admin == 2) {
$deleteComment->deleteComment($dbh, $_GET['commentid']);
header("Location: post?id=" . $_GET['postid']);
die;
}
}
} else {
die;
}
} else {