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


PHP formhash函数代码示例

本文整理汇总了PHP中formhash函数的典型用法代码示例。如果您正苦于以下问题:PHP formhash函数的具体用法?PHP formhash怎么用?PHP formhash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: submitcheck

 public static function submitcheck($var, $allowget = 0, $seccodecheck = 0, $secqaacheck = 0)
 {
     if (!getgpc($var)) {
         return FALSE;
     } else {
         global $_G;
         if ($allowget || $_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_GET['formhash']) && $_GET['formhash'] == formhash() && empty($_SERVER['HTTP_X_FLASH_VERSION']) && (empty($_SERVER['HTTP_REFERER']) || preg_replace("/https?:\\/\\/([^\\:\\/]+).*/i", "\\1", $_SERVER['HTTP_REFERER']) == preg_replace("/([^\\:]+).*/", "\\1", $_SERVER['HTTP_HOST']))) {
             if (empty($_GET['phone_reg'])) {
                 if (checkperm('seccode')) {
                     if ($secqaacheck && !check_secqaa($_GET['secanswer'], $_GET['sechash'])) {
                         showmessage('submit_secqaa_invalid');
                     }
                     if ($seccodecheck && !check_seccode($_GET['seccodeverify'], $_GET['sechash'])) {
                         showmessage('submit_seccode_invalid');
                     }
                 }
             }
             return TRUE;
             // For ios reg modify by heavenK
         } elseif ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_GET['formhash']) && !empty($_GET['phone_reg']) && empty($_SERVER['HTTP_X_FLASH_VERSION']) && empty($_SERVER['HTTP_REFERER'])) {
             return TRUE;
         } else {
             //add by zh
             if ($_GET['mod'] == 'sms' && $_GET['flag'] == 1) {
                 exit(lang('message', 'submit_invalid'));
             } else {
                 showmessage('submit_invalid');
             }
         }
     }
 }
开发者ID:Jaedeok-seol,项目名称:discuz_template,代码行数:31,代码来源:helper_form.php

示例2: index

 function index()
 {
     global $viewhelper;
     $viewhelper->setPosition(L("apply_friendlink", "tpl"));
     formhash();
     render("friendlink");
 }
开发者ID:reboxhost,项目名称:phpb2b,代码行数:7,代码来源:friendlink_controller.php

示例3: _init_env

 function _init_env()
 {
     error_reporting(E_ERROR);
     if (phpversion() < '5.3.0') {
         set_magic_quotes_runtime(0);
     }
     define('MAGIC_QUOTES_GPC', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc());
     define('ICONV_ENABLE', function_exists('iconv'));
     define('MB_ENABLE', function_exists('mb_convert_encoding'));
     define('FORMHASH', formhash());
     define('TIMESTAMP', time());
     $_SERVER['HTTP_USER_AGENT'] = empty($_SERVER['HTTP_USER_AGENT']) ? '' : $_SERVER['HTTP_USER_AGENT'];
     foreach ($GLOBALS as $key => $value) {
         if (!isset($this->superglobal[$key])) {
             $GLOBALS[$key] = null;
             unset($GLOBALS[$key]);
         }
     }
     global $_G;
     $_G = array('uid' => 0, 'username' => 'Guest', 'formhash' => '', 'timestamp' => TIMESTAMP, 'starttime' => array_sum(explode(' ', microtime())), 'clientip' => $this->_get_client_ip(), 'referer' => '', 'charset' => '', 'timenow' => array(), 'cookiepre' => '', 'PHP_SELF' => '', 'siteurl' => '', 'siteroot' => '', 'authkey' => '', 'config' => array(), 'setting' => array('sitetheme' => 'default'), 'member' => array(), 'cookie' => array(), 'style' => array(), 'cache' => array());
     $_G['PHP_SELF'] = htmlspecialchars($_SERVER['SCRIPT_NAME'] ? $_SERVER['SCRIPT_NAME'] : $_SERVER['PHP_SELF']);
     $_G['basescript'] = CURSCRIPT;
     $_G['basefilename'] = basename($_G['PHP_SELF']);
     $_G['siteurl'] = htmlspecialchars('http://' . $_SERVER['HTTP_HOST'] . preg_replace("/\\/+(api)?\\/*\$/i", '', substr($_G['PHP_SELF'], 0, strrpos($_G['PHP_SELF'], '/'))) . '/');
     $_G['siteroot'] = substr($_G['PHP_SELF'], 0, -strlen($_G['basefilename']));
 }
开发者ID:pan289091315,项目名称:Discuz,代码行数:26,代码来源:brand.class.php

示例4: uploadfile

 public function uploadfile()
 {
     if ($_GET['from'] == 'swfupload') {
         $uid = intval($_GET['uid']);
         $username = trim($_GET['username']);
         $token = sha1($uid . $username . formhash());
         if (!$uid || !$username || $token != $_GET['token']) {
             echo json_encode(array('state' => 0, 'info' => 'nologin'));
             exit;
         }
     } else {
         $this->_checkuser();
         $uid = $this->uid;
     }
     $config = $GLOBALS['G']['config']['output'];
     $upload = new Upload();
     $attachment = 'attach/' . date('Y') . '/' . date('m') . '/' . $upload->setfilename();
     if ($upload->save(ROOT_PATH . '/' . $config['attachdir'] . '/' . $attachment)) {
         $attachdata = array('uid' => $uid, 'attachname' => $upload->oriname(), 'attachment' => $attachment, 'attachsize' => $upload->size(), 'attachtype' => $upload->type(), 'attachtime' => time());
         $attachdata['attachid'] = $this->t('attachment')->insert($attachdata, true);
         echo json_encode(array('state' => 1, 'data' => $attachdata));
         exit;
     } else {
         echo json_encode(array('state' => 0, 'info' => 'Upload Failed(' . $upload->error . ')'));
         exit;
     }
 }
开发者ID:xy113,项目名称:XiangBaLaoServer,代码行数:27,代码来源:class.MiscController.php

示例5: global_footer

    public function global_footer()
    {
        global $_G, $_GET;
        if (self::$securityStatus != TRUE) {
            return false;
        }
        $formhash = formhash();
        if ($_G['adminid']) {
            $processName = 'securityOperate';
            if (self::$isAdminGroup && !discuz_process::islocked($processName, 30)) {
                $ajaxReportScript = <<<EOF
\t\t\t\t\t<script type='text/javascript'>
\t\t\t\t\tvar url = SITEURL + '/plugin.php?id=security:sitemaster';
\t\t\t\t\tvar x = new Ajax();
\t\t\t\t\tx.post(url, 'formhash={$formhash}', function(s){});
\t\t\t\t\t</script>
EOF;
            }
        }
        $processName = 'securityRetry';
        $time = 10;
        if (!discuz_process::islocked($processName, $time)) {
            if (C::t('#security#security_failedlog')->count()) {
                $ajaxRetryScript = <<<EOF
\t\t\t\t\t<script type='text/javascript'>
\t\t\t\t\tvar urlRetry = SITEURL + '/plugin.php?id=security:job';
\t\t\t\t\tvar ajaxRetry = new Ajax();
\t\t\t\t\tajaxRetry.post(urlRetry, 'formhash={$formhash}', function(s){});
\t\t\t\t\t</script>
EOF;
            }
        }
        return $ajaxReportScript . $ajaxRetryScript;
    }
开发者ID:softhui,项目名称:discuz,代码行数:34,代码来源:security.class.php

示例6: setloginstatus

function setloginstatus($member, $cookietime)
{
    global $_G;
    $_G['uid'] = intval($member['uid']);
    $_G['username'] = $member['username'];
    $_G['adminid'] = $member['adminid'];
    $_G['groupid'] = $member['groupid'];
    $_G['formhash'] = formhash();
    $_G['session']['invisible'] = getuserprofile('invisible');
    $_G['member'] = $member;
    loadcache('usergroup_' . $_G['groupid']);
    C::app()->session->isnew = true;
    C::app()->session->updatesession();
    dsetcookie('auth', authcode("{$member['password']}\t{$member['uid']}", 'ENCODE'), $cookietime, 1, true);
    dsetcookie('loginuser');
    dsetcookie('activationauth');
    dsetcookie('pmnum');
    include_once libfile('function/stat');
    updatestat('login', 1);
    if (defined('IN_MOBILE')) {
        updatestat('mobilelogin', 1);
    }
    if ($_G['setting']['connect']['allow'] && $_G['member']['conisbind']) {
        updatestat('connectlogin', 1);
    }
    $rule = updatecreditbyaction('daylogin', $_G['uid']);
    if (!$rule['updatecredit']) {
        checkusergroup($_G['uid']);
    }
}
开发者ID:tang86,项目名称:discuz-utf8,代码行数:30,代码来源:function_member.php

示例7: global_footer

    function global_footer()
    {
        global $_G;
        if (!$this->_secStatus) {
            return false;
        }
        $formhash = formhash();
        $ajaxReportScript = '';
        $processName = 'securitOperate';
        if ($this->isAdminGroup && !discuz_process::islocked($processName, 10)) {
            $ajaxReportScript = <<<EOF
\t\t\t<script type='text/javascript'>
\t\t\tvar url = SITEURL + '/plugin.php?id=security:sitemaster';
\t\t\tvar x = new Ajax();
\t\t\tx.post(url, 'formhash={$formhash}', function(s){});
\t\t\t</script>
EOF;
        }
        $processName = 'securitRetry';
        $time = 5;
        if ($_G['gp_d']) {
            $time = 1;
        }
        if (!discuz_process::islocked($processName, $time)) {
            $ajaxRetryScript = <<<EOF
\t\t\t<script type='text/javascript'>
\t\t\tvar urlRetry = SITEURL + '/plugin.php?id=security:job';
\t\t\tvar ajaxRetry = new Ajax();
\t\t\tajaxRetry.post(urlRetry, 'formhash={$formhash}', function(s){});
\t\t\t</script>
EOF;
        }
        return $ajaxReportScript . $ajaxRetryScript;
    }
开发者ID:v998,项目名称:discuzx-en,代码行数:34,代码来源:security.class.php

示例8: onUsersGetFormHash

 public function onUsersGetFormHash($uId, $userAgent)
 {
     global $_G;
     $uId = intval($uId);
     if (!$uId) {
         return false;
     }
     $member = getuserbyuid($uId, 1);
     $_G['username'] = $member['username'];
     $_G['uid'] = $member['uid'];
     $_G['authkey'] = md5($_G['config']['security']['authkey'] . $userAgent);
     return formhash();
 }
开发者ID:softhui,项目名称:discuz,代码行数:13,代码来源:Users.php

示例9: submitcheck

function submitcheck($var)
{
    $CI =& get_instance();
    if ($CI->input->post($var) && $_SERVER['REQUEST_METHOD'] == 'POST') {
        if ((empty($_SERVER['HTTP_REFERER']) || preg_replace("/https?:\\/\\/([^\\:\\/]+).*/i", "\\1", $_SERVER['HTTP_REFERER']) == preg_replace("/([^\\:]+).*/", "\\1", $_SERVER['HTTP_HOST'])) && $CI->input->userdata('formhash') == formhash()) {
            return true;
        } else {
            showmessage('submit_invalid');
        }
    } else {
        return false;
    }
}
开发者ID:sdgdsffdsfff,项目名称:hiveAdmin,代码行数:13,代码来源:functions_helper.php

示例10: common_base

 function common_base()
 {
     global $_G;
     if (!isset($_G['connect'])) {
         $_G['connect']['url'] = 'http://connect.discuz.qq.com';
         $_G['connect']['api_url'] = 'http://api.discuz.qq.com';
         $_G['connect']['avatar_url'] = 'http://avatar.connect.discuz.qq.com';
         // QZone公共分享页面URL
         $_G['connect']['qzone_public_share_url'] = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey';
         $_G['connect']['referer'] = !$_G['inajax'] && CURSCRIPT != 'member' ? $_G['basefilename'] . ($_SERVER['QUERY_STRING'] ? '?' . $_SERVER['QUERY_STRING'] : '') : dreferer();
         // 微薄公共分享Appkey
         $_G['connect']['weibo_public_appkey'] = 'ce7fb946290e4109bdc9175108b6db3a';
         // 新版Connect登录本地代理页
         $_G['connect']['login_url'] = $_G['siteurl'] . 'connect.php?mod=login&op=init&referer=' . urlencode($_G['connect']['referer'] ? $_G['connect']['referer'] : 'index.php');
         // 新版Connect本地Callback代理页
         $_G['connect']['callback_url'] = $_G['siteurl'] . 'connect.php?mod=login&op=callback';
         // 发feed js通知本地代理页
         $_G['connect']['discuz_new_feed_url'] = $_G['siteurl'] . 'connect.php?mod=feed&op=new&formhash=' . formhash();
         $_G['connect']['discuz_new_post_feed_url'] = $_G['siteurl'] . 'connect.php?mod=feed&op=new&action=post&formhash=' . formhash();
         // 发分享js通知本地代理页
         //$_G['connect']['discuz_new_share_url'] = $_G['siteurl'].'connect.php?mod=share&op=new';
         $_G['connect']['discuz_new_share_url'] = $_G['siteurl'] . 'home.php?mod=spacecp&ac=plugin&id=qqconnect:spacecp&pluginop=new';
         // 分享到微博后的回流处理地址
         $_G['connect']['discuz_sync_tthread_url'] = $_G['siteurl'] . 'home.php?mod=spacecp&ac=plugin&id=qqconnect:spacecp&pluginop=sync_tthread&formhash=' . formhash();
         // 更换QQ号登录本地代理页
         $_G['connect']['discuz_change_qq_url'] = $_G['siteurl'] . 'connect.php?mod=login&op=change';
         // QC授权项对应关系
         $_G['connect']['auth_fields'] = array('is_user_info' => 1, 'is_feed' => 2);
         if ($_G['uid']) {
             dsetcookie('connect_is_bind', $_G['member']['conisbind'], 31536000);
             if (!$_G['member']['conisbind'] && $_G['cookie']['connect_login']) {
                 $_G['cookie']['connect_login'] = 0;
                 dsetcookie('connect_login');
             }
         }
         // QQ互联游客更换用户名为QQ昵称
         if (!$_G['uid'] && $_G['connectguest']) {
             if ($_G['cookie']['connect_qq_nick']) {
                 $_G['member']['username'] = $_G['cookie']['connect_qq_nick'];
             } else {
                 $connectGuest = C::t('#qqconnect#common_connect_guest')->fetch($conopenid);
                 if ($connectGuest['conqqnick']) {
                     $_G['member']['username'] = $connectGuest['conqqnick'];
                 }
             }
         }
         if ($this->allow && !$_G['uid'] && !defined('IN_MOBILE')) {
             $_G['setting']['pluginhooks']['global_login_text'] = tpl_login_bar();
         }
     }
 }
开发者ID:dalinhuang,项目名称:healthshop,代码行数:51,代码来源:connect.class.php

示例11: setloginstatus

function setloginstatus($member, $cookietime)
{
    global $_G;
    $_G['uid'] = $member['uid'];
    $_G['username'] = $member['username'];
    $_G['adminid'] = $member['adminid'];
    $_G['groupid'] = $member['groupid'];
    $_G['formhash'] = formhash();
    $_G['session']['invisible'] = getuserprofile('invisible');
    $_G['member'] = $member;
    $_G['core']->session->isnew = 1;
    dsetcookie('auth', authcode("{$member['password']}\t{$member['uid']}", 'ENCODE'), $cookietime, 1, true);
    dsetcookie('loginuser');
    dsetcookie('activationauth');
    dsetcookie('pmnum');
}
开发者ID:Kingson4Wu,项目名称:php_demo,代码行数:16,代码来源:function_login.php

示例12: setloginstatus

function setloginstatus($member, $cookietime)
{
    global $_G;
    foreach ($_G['cookie'] as $k => $v) {
        dsetcookie($k);
    }
    $_G['uid'] = $member['uid'];
    $_G['username'] = addslashes($member['username']);
    $_G['adminid'] = $member['adminid'];
    $_G['groupid'] = $member['groupid'];
    $_G['formhash'] = formhash();
    $_G['session']['invisible'] = getuserprofile('invisible');
    $_G['member'] = $member;
    $discuz =& discuz_core::instance();
    $discuz->session->isnew = true;
    dsetcookie('auth', authcode("{$member['password']}\t{$member['uid']}", 'ENCODE'), $cookietime, 1, true);
    dsetcookie('loginuser');
    dsetcookie('activationauth');
    dsetcookie('pmnum');
}
开发者ID:v998,项目名称:discuzx-en,代码行数:20,代码来源:function_member.php

示例13: submitcheck

 public static function submitcheck($var, $allowget = 0, $seccodecheck = 0, $secqaacheck = 0)
 {
     if (!getgpc($var)) {
         return FALSE;
     } else {
         global $_G;
         if ($allowget || $_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_GET['formhash']) && $_GET['formhash'] == formhash() && empty($_SERVER['HTTP_X_FLASH_VERSION']) && (empty($_SERVER['HTTP_REFERER']) || strncmp($_SERVER['HTTP_REFERER'], 'http://wsq.discuz.qq.com', 24) === 0 || strncmp($_SERVER['HTTP_REFERER'], 'http://m.wsq.qq.com', 19) === 0 || preg_replace("/https?:\\/\\/([^\\:\\/]+).*/i", "\\1", $_SERVER['HTTP_REFERER']) == preg_replace("/([^\\:]+).*/", "\\1", $_SERVER['HTTP_HOST']))) {
             if (checkperm('seccode')) {
                 if ($secqaacheck && !check_secqaa($_GET['secanswer'], $_GET['secqaahash'])) {
                     showmessage('submit_secqaa_invalid');
                 }
                 if ($seccodecheck && !check_seccode($_GET['seccodeverify'], $_GET['seccodehash'], 0, $_GET['seccodemodid'])) {
                     showmessage('submit_seccode_invalid');
                 }
             }
             return TRUE;
         } else {
             showmessage('submit_invalid');
         }
     }
 }
开发者ID:MCHacker,项目名称:discuz-docker,代码行数:21,代码来源:helper_form.php

示例14: output

 function output()
 {
     global $_G;
     parse_str($_G['messageparam'][1], $p);
     $variable = array('auth' => $p['auth']);
     if ($_G['uid']) {
         require_once DISCUZ_ROOT . './source/plugin/wechat/wsq.class.php';
         if (method_exists('wsq', 'userloginUrl')) {
             $_source = isset($_GET['_source']) ? $_GET['_source'] : '';
             if (!$_source && !empty($_GET['openid']) && !empty($_GET['openidsign'])) {
                 $variable['loginUrl'] = wsq::userloginUrl($_G['uid'], $_GET['openid'], $_GET['openidsign']);
                 if (!C::t('#wechat#common_member_wechatmp')->fetch($_G['uid'])) {
                     C::t('#wechat#common_member_wechatmp')->insert(array('uid' => $_G['uid'], 'openid' => $_GET['openid'], 'status' => 1), false, true);
                 }
             } else {
                 $variable['loginUrl'] = wsq::userloginUrl2($_G['uid']);
             }
         }
     }
     $variable['formhash'] = formhash();
     mobile_core::result(mobile_core::variable($variable));
 }
开发者ID:lemonstory,项目名称:bbs,代码行数:22,代码来源:login.php

示例15: formhash

">友情链接</a> | 
<a href="<?php 
    echo S_URL;
    ?>
/html/49/n-17649.html">版权声明</a> | 
<a href="<?php 
    echo S_URL;
    ?>
/html/48/n-17648.html">联系我们</a>
</p>
<form action="<?php 
    echo S_URL;
    ?>
/batch.search.php" method="post">
<input type="hidden" name="formhash" value="<?php 
    echo formhash();
    ?>
" />
<input type="hidden" name="searchname" id="searchname" value="subject" />
<p class="footer_search">
<select name="searchtxt" id="searchtxt" onchange="changetype();">
<option value="标题">标题</option>
<option value="内容">内容</option>
<option value="作者">作者</option>
</select>
<input class="input_tx" type="text" value="" name="searchkey" size="30"/>
<input class="input_search" type="submit" value="搜索" name="searchbtn"/>
</p>
</form>
</div>
<div class="copyright">
开发者ID:hongz1125,项目名称:devil,代码行数:31,代码来源:tpl_tobo20130125_o_footer.php


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