當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ReferCheck函數代碼示例

本文整理匯總了PHP中ReferCheck函數的典型用法代碼示例。如果您正苦於以下問題:PHP ReferCheck函數的具體用法?PHP ReferCheck怎麽用?PHP ReferCheck使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了ReferCheck函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Auth

<?php

include __DIR__ . '/common.php';
require __DIR__ . '/language/' . ForumLanguage . '/new.php';
Auth(1, 0, true);
$Error = '';
$Title = '';
$Content = '';
$TagsArray = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    SetStyle('api', 'API');
    if (!ReferCheck($_POST['FormHash'])) {
        AlertMsg($Lang['Error_Unknown_Referer'], $Lang['Error_Unknown_Referer'], 403);
    }
    if ($TimeStamp - $CurUserInfo['LastPostTime'] <= 5) {
        //發帖至少要間隔5秒
        AlertMsg($Lang['Posting_Too_Often'], $Lang['Posting_Too_Often']);
    }
    $Title = Request('Post', 'Title');
    $Content = Request('Post', 'Content');
    $TagsArray = $_POST['Tag'];
    if ($Title) {
        if (strlen($Title) <= $Config['MaxTitleChars'] || strlen($Content) <= $Config['MaxPostChars']) {
            if (!empty($TagsArray) && !in_array('', $TagsArray) && count($TagsArray) <= $Config["MaxTagsNum"]) {
                //獲取已存在的標簽
                $TagsExistArray = $DB->query("SELECT ID,Name FROM `" . $Prefix . "tags` WHERE `Name` in (?)", $TagsArray);
                $TagsExist = ArrayColumn($TagsExistArray, 'Name');
                $TagsID = ArrayColumn($TagsExistArray, 'ID');
                //var_dump($TagsExist);
                $NewTags = TagsDiff($TagsArray, $TagsExist);
                //新建不存在的標簽
開發者ID:npk,項目名稱:Carbon-Forum,代碼行數:31,代碼來源:new.php

示例2: isset

$Error = '';
$ErrorCode = 101000;
$UserName = '';
$ReturnUrl = isset($_SERVER['HTTP_REFERER']) ? htmlspecialchars($_SERVER["HTTP_REFERER"]) : '';
if (isset($_GET['logout']) && $_GET['logout'] == $CurUserCode) {
    LogOut();
    if ($ReturnUrl) {
        header('location: ' . $ReturnUrl);
        exit('logout');
    } else {
        header('location: ' . $Config['WebsitePath'] . '/');
        exit('logout');
    }
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' || $IsApp) {
    if (!ReferCheck(Request('Post', 'FormHash'))) {
        AlertMsg($Lang['Error_Unknown_Referer'], $Lang['Error_Unknown_Referer'], 403);
    }
    $ReturnUrl = htmlspecialchars(Request('Post', 'ReturnUrl'));
    $UserName = strtolower(Request('Post', 'UserName'));
    $Password = Request('Post', 'Password');
    $Expires = min(intval(Request('Post', 'Expires', 30)), 30);
    //最多保持登陸30天
    $VerifyCode = intval(Request('Post', 'VerifyCode'));
    do {
        if (!$UserName || !$Password || !$VerifyCode) {
            $Error = $Lang['Forms_Can_Not_Be_Empty'];
            $ErrorCode = 101001;
            break;
        }
        session_start();
開發者ID:rssawhney,項目名稱:Carbon-Forum,代碼行數:31,代碼來源:login.php

示例3: AlertMsg

    if (!$OauthObject->GetAccessToken($CurProtocol . $_SERVER['HTTP_HOST'] . $Config['WebsitePath'], $AppID, $AppInfo['AppSecret'], $Code)) {
        AlertMsg('400 Bad Request', '400 Bad Request', 400);
    }
    if (!$OauthObject->GetOpenID()) {
        AlertMsg('400 Bad Request', '400 Bad Request', 400);
    }
    // 非Post頁,儲存AccessToken
    $_SESSION[$Prefix . 'OauthAccessToken'] = $OauthObject->AccessToken;
    // 釋放session防止阻塞
    session_write_close();
    $OauthUserID = $DB->single("SELECT UserID FROM " . $Prefix . "app_users \n\t\tWHERE AppID=:AppID AND OpenID = :OpenID", array('AppID' => $AppID, 'OpenID' => $OauthObject->OpenID));
    $OauthObject->GetUserInfo();
    CheckOpenID();
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (!ReferCheck(Request('Post', 'FormHash')) || empty($_SESSION[$Prefix . 'OauthAccessToken']) || !$State || empty($_SESSION[$Prefix . 'OauthState']) || $State != $_SESSION[$Prefix . 'OauthState']) {
        AlertMsg($Lang['Error_Unknown_Referer'], $Lang['Error_Unknown_Referer'], 403);
    }
    // 讀入Access Token
    $OauthObject->AccessToken = $_SESSION[$Prefix . 'OauthAccessToken'];
    // 釋放session防止阻塞
    session_write_close();
    if (!$OauthObject->GetOpenID()) {
        AlertMsg('400 Bad Request', '400 Bad Request', 400);
    }
    $OauthUserInfo = $OauthObject->GetUserInfo();
    CheckOpenID();
    $UserName = strtolower(Request('Post', 'UserName'));
    if ($UserName && IsName($UserName)) {
        $UserExist = $DB->single("SELECT ID FROM " . $Prefix . "users WHERE UserName = :UserName", array('UserName' => $UserName));
        if (!$UserExist) {
開發者ID:MrMoDoor,項目名稱:Carbon-Forum,代碼行數:31,代碼來源:oauth.php


注:本文中的ReferCheck函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。