当前位置: 首页>>代码示例>>PHP>>正文


PHP post::findPost方法代码示例

本文整理汇总了PHP中post::findPost方法的典型用法代码示例。如果您正苦于以下问题:PHP post::findPost方法的具体用法?PHP post::findPost怎么用?PHP post::findPost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在post的用法示例。


在下文中一共展示了post::findPost方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: post

require_once "models/PasswordHash.php";
require_once "models/post.php";
session_start();
//Make sure the user is logged in
if (isset($_SESSION['user'])) {
    $user = $_SESSION['user'];
} else {
    die;
}
//If they aren't an admin they aren't allowed here either
if ($user->admin != 2) {
    die;
}
//If they are authorized to be here, make a class object to handle the post
$post = new post();
//If the id is set in the query string, do the following
if (isset($_GET['id'])) {
    //First find the post in the database
    $page = $post->findPost($dbh, $_GET['id']);
    //If it doesn't exist, kill the page
    if (!$page) {
        die;
    } else {
        //And then send them back to the main page
        $post->deletePost($dbh, $page->id);
        header("Location: /");
        die;
    }
} else {
    die;
}
开发者ID:kelmo2,项目名称:leagueOfLegendsClubSite,代码行数:31,代码来源:deletePost.php

示例2: header

    $user = $_SESSION['user'];
} else {
    header("Location: loginCheckCtrl");
    die;
}
//If they are logged in but not an admin kill the page
if ($user->admin != 2) {
    die;
}
//Create the flags and class object
$post = new post();
$error = true;
$sent = false;
if (isset($_GET['id'])) {
    $id = $_GET['id'];
    $postToEdit = $post->findPost($dbh, $id);
    //If that post doesn't exist, just kill the page
    if (!$postToEdit) {
        die;
    }
} else {
    die;
}
//Otherwise let them edit the post.
if ($_POST) {
    if (isset($_POST['title'])) {
        if (empty($_POST['title'])) {
            $error = false;
        }
    } else {
        $error = false;
开发者ID:kelmo2,项目名称:leagueOfLegendsClubSite,代码行数:31,代码来源:editPost.php


注:本文中的post::findPost方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。