本文整理汇总了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 {