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


PHP getcookie函数代码示例

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


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

示例1: updategroupcreditlog

function updategroupcreditlog($fid, $uid)
{
    global $_G;
    if (empty($fid) || empty($uid)) {
        return false;
    }
    $today = date('Ymd', TIMESTAMP);
    $updategroupcredit = getcookie('groupcredit_' . $fid);
    if ($updategroupcredit < $today) {
        $status = DB::result_first("SELECT logdate FROM " . DB::table('forum_groupcreditslog') . " WHERE fid='{$fid}' AND uid='{$uid}' AND logdate='{$today}'");
        if (empty($status)) {
            DB::query("UPDATE " . DB::table('forum_forum') . " SET commoncredits=commoncredits+1 WHERE fid='{$fid}'");
            DB::query("REPLACE INTO " . DB::table('forum_groupcreditslog') . " (fid, uid, logdate) VALUES ('{$fid}', '{$uid}', '{$today}')");
            if (empty($_G['forum']) || empty($_G['forum']['level'])) {
                $forum = DB::fetch_first("SELECT name, level, commoncredits FROM " . DB::table('forum_forum') . " WHERE fid='{$fid}'");
            } else {
                $_G['forum']['commoncredits']++;
                $forum =& $_G['forum'];
            }
            if (empty($_G['grouplevels'])) {
                loadcache('grouplevels');
            }
            $grouplevel = $_G['grouplevels'][$forum['level']];
            if ($grouplevel['type'] == 'default' && !($forum['commoncredits'] >= $grouplevel['creditshigher'] && $forum['commoncredits'] < $grouplevel['creditslower'])) {
                $levelid = DB::result_first("SELECT levelid FROM " . DB::table('forum_grouplevel') . " WHERE type='default' AND creditshigher<='{$forum['commoncredits']}' AND creditslower>'{$forum['commoncredits']}' LIMIT 1");
                if (!empty($levelid)) {
                    DB::query("UPDATE " . DB::table('forum_forum') . " SET level='{$levelid}' WHERE fid='{$fid}'");
                    $groupfounderuid = DB::result_first("SELECT founderuid FROM " . DB::table('forum_forumfield') . " WHERE fid='{$fid}' LIMIT 1");
                    notification_add($groupfounderuid, 'system', 'grouplevel_update', array('groupname' => '<a href="forum.php?mod=group&fid=' . $fid . '">' . $forum['name'] . '</a>', 'newlevel' => $_G['grouplevels'][$levelid]['leveltitle']));
                }
            }
        }
        dsetcookie('groupcredit_' . $fid, $today, 86400);
    }
}
开发者ID:dalinhuang,项目名称:hlwbbsvincent,代码行数:35,代码来源:function_grouplog.php

示例2: global_cpnav_extra1

 public function global_cpnav_extra1()
 {
     $custom_zone = getcookie('bacy_gmt_cz');
     if (!$custom_zone) {
         $custom_zone = 8;
     }
     $data = lang('home/template', 'timezone');
     $command_str = "\$timezone=array({$data});";
     eval($command_str);
     $gmt = '<script type="text/javascript" src="./source/plugin/bacy_gmt/gmt.js" ></script>';
     $gmt .= '<a id="bacy_gmt" href="javascript:;" style="text-decoration:none;" onmouseover="delayShow(this, function(){showMenu({\'ctrlid\':\'bacy_gmt\',\'pos\':\'43!\',\'duration\':\'3\'})});"></a>';
     $gmt .= '<table id="bacy_gmt_menu" class="p_pop" style="display:none;">';
     $gmt .= '<tr><td><div class="y"><a href="plugin.php?id=bacy_gmt:gmt&act=aboutme" onclick="showWindow(\'gmt_aboutme\',this.href);return false;">[About Me]</a><a href="javascript:;" onclick="hideMenu(\'bacy_gmt_menu\');">[X]</a></div><strong>' . lang('plugin/bacy_gmt', 'info') . '</strong></td></tr>';
     $gmt .= '<tr><td><select id="bacy_gmt_timeoffset" onchange="hideMenu(\'bacy_gmt_menu\'),setcookie(\'bacy_gmt_cz\',this.value,86400 * 30);startGmtClock();">';
     foreach ($timezone as $key => $desc) {
         if ($key < 9999) {
             if ($key == $custom_zone) {
                 $gmt .= '<option value="' . $key . '" selected >' . $desc . '</option>';
             } else {
                 $gmt .= '<option value="' . $key . '" >' . $desc . '</option>';
             }
         }
     }
     $gmt .= '</select></td></tr><tr><td></td></tr>';
     $gmt .= '</table>';
     $gmt .= '<script type="text/javascript">startGmtClock()</script>';
     return $gmt;
 }
开发者ID:tang86,项目名称:discuz-utf8,代码行数:28,代码来源:gmt.class.php

示例3: __construct

 function __construct()
 {
     global $_G;
     //C1:不在用户组;C2:未签到;C3:已签到,没有cookies;C4:已签到,有cookies;
     $this->_table['l'] = 'plugin_dsuamupper';
     $this->_table['c'] = 'plugin_dsuamupperc';
     if ($_G['uid']) {
         $this->vars = $_G['cache']['plugin']['dsu_amupper'];
         $this->vars['offset'] = $_G['setting']['timeoffset'];
         $this->vars['gids'] = (array) unserialize($this->vars['gids']);
         $this->vars['zdqd'] = (array) unserialize($this->vars['zdqd']);
         $this->vars['today'] = dgmdate($_G['timestamp'], 'Ymd', $this->vars['offset']);
         $this->_cookise = getcookie('dsu_amupper');
         $this->_cookised = getcookie('dsu_amuppered');
         $this->_time = 0;
         if (!$this->_cookised || !$this->_cookise) {
             $this->vars['uid'] = C::t('#dsu_amupper#plugin_dsuamupper')->fetch($_G['uid']);
             //$this->_time = $this->_istoday($this->vars['uid']['lasttime']);
         } elseif ($this->_cookised == $_G['uid']) {
             $this->_time = 0;
         } else {
             $this->_time = -1;
         }
     }
 }
开发者ID:vanloswang,项目名称:discuzx-1,代码行数:25,代码来源:pper.class.php

示例4: login

 /**
  * 登录验证
  */
 public function login()
 {
     $account = htmlspecialchars(trim($_GET['account']));
     $password = trim($_GET['password']);
     $captchacode = trim($_GET['captchacode']);
     if ($captchacode && $captchacode != getcookie('captchacode')) {
         $this->showAppError(-1, '验证码输入错误', array('code' => $captchacode));
     }
     if (strlen($account) < 2) {
         $this->showAppError(-2, '账号输入不正确', array('account' => $account));
     }
     if (strlen($password) < 6) {
         $this->showAppError(-3, '密码输入不正确', array('password' => $password));
     }
     $member = new Member();
     if (isemail($account)) {
         $returns = $member->Login($account, $password, 'email');
     } elseif (ismobile($account)) {
         $returns = $member->Login($account, $password, 'mobile');
     }
     if ($member->uid < 0) {
         $returns = $member->Login($account, $password);
     }
     if ($member->uid > 0) {
         $returns['userpic'] = avatar($member->uid);
         $this->showAppData($returns);
     } else {
         $this->showAppError(-4, '账号和密码不匹配', array('account' => $account, 'password' => $password));
     }
 }
开发者ID:xy113,项目名称:XiangBaLaoServer,代码行数:33,代码来源:class.MemberController.php

示例5: mobileplugin_dsu_amupper

 function mobileplugin_dsu_amupper()
 {
     global $_G;
     loadcache('plugin');
     $this->vars = $_G['cache']['plugin']['dsu_amupper'];
     $this->vars['offset'] = $_G['setting']['timeoffset'];
     $this->vars['today'] = dgmdate($_G['timestamp'], 'Ymd', $this->vars['offset']);
     $this->cookiefooter = getcookie('dsu_amupper_footer');
 }
开发者ID:v998,项目名称:dsu,代码行数:9,代码来源:mobile.class.php

示例6: plugin_dsu_amupper

 function plugin_dsu_amupper()
 {
     global $_G;
     $this->vars = $_G['cache']['plugin']['dsu_amupper'];
     $this->vars['offset'] = $_G['setting']['timeoffset'];
     $this->vars['today'] = dgmdate($_G['timestamp'], 'Ymd', $this->vars['offset']);
     $this->cookiefooter = getcookie('dsu_amupper_footer' . $_G['uid']);
     $this->cookieforce = getcookie('dsu_amupper_force' . $_G['uid']);
     $this->from = $_SERVER['HTTP_REFERER'];
 }
开发者ID:v998,项目名称:dsu,代码行数:10,代码来源:pper.class.php

示例7: register_input

 function register_input()
 {
     global $_G;
     $_G['gp_rid'] = strip_tags($_G['gp_rid']);
     $return = '';
     if ($_G['gp_action'] == 'activation') {
         include template('dsu_amufzc:afzc');
         return $return;
     } else {
         $input = (array) unserialize(base64_decode(getcookie('dsu_amufzc_' . $_G['gp_rid'])));
         include template('dsu_amufzc:fzc');
         return $return;
     }
 }
开发者ID:v998,项目名称:dsu,代码行数:14,代码来源:fzc.class.php

示例8: global_footer

 function global_footer()
 {
     global $_G;
     $result = '';
     $uid = (int) $_G['uid'];
     if (!empty($uid) && (CURSCRIPT != 'home' && $_GET['mod'] != 'spacecp')) {
         $showpop = getcookie('ltncpop');
         if (empty($showpop)) {
             $ifset = DB::result_first("SELECT addname FROM " . DB::table('common_member') . " WHERE uid={$uid}");
             if (empty($ifset)) {
                 $result = " ";
             }
         }
     }
     return $result;
 }
开发者ID:deepziyu,项目名称:JX3PVE,代码行数:16,代码来源:pop.class.php

示例9: LOGIN

 public function LOGIN()
 {
     //var_dump($this->Model->database);
     $content = array();
     $user = getpost("user");
     $pass = getpost("pass");
     $usercookie = getcookie("user");
     $passcookie = getcookie("pass");
     ob_start();
     if ($usercookie != null) {
         if ($passcookie != null) {
             $data = $this->Model->database->login($usercookie, $passcookie);
             if ($data['login'] == 1) {
                 header('location:index.php?controll=kiemtra&action=manager');
             }
         }
     }
     if (isset($_POST['submit'])) {
         if ($user != null) {
             if ($pass != null) {
                 $data = $this->Model->database->login($user, $pass);
                 if ($data['login'] == 1) {
                     setcookie("user", $user, time() + 360);
                     setcookie("pass", $pass, time() + 360);
                     header('location:index.php?controll=kiemtra&action=manager');
                 } else {
                     echo "Tài khoản hoặc mật khẩu sai!";
                 }
             } else {
                 echo "Bạn chưa nhập password!";
             }
         } else {
             echo "Bạn chưa nhập user!";
         }
     }
     $content = ob_get_contents();
     ob_end_clean();
     $this->View->load("login", $content);
     $this->View->Show();
 }
开发者ID:WHTGo,项目名称:EXP-Training,代码行数:40,代码来源:KIEMTRA.php

示例10: updategroupcreditlog

function updategroupcreditlog($fid, $uid)
{
    global $_G;
    if (empty($fid) || empty($uid)) {
        return false;
    }
    $today = date('Ymd', TIMESTAMP);
    $updategroupcredit = getcookie('groupcredit_' . $fid);
    if ($updategroupcredit < $today) {
        $status = C::t('forum_groupcreditslog')->check_logdate($fid, $uid, $today);
        if (empty($status)) {
            C::t('forum_forum')->update_commoncredits($fid);
            C::t('forum_groupcreditslog')->insert(array('fid' => $fid, 'uid' => $uid, 'logdate' => $today), false, true);
            if (empty($_G['forum']) || empty($_G['forum']['level'])) {
                $forum = C::t('forum_forum')->fetch($fid);
                $forum = array('name' => $forum['name'], 'level' => $forum['level'], 'commoncredits' => $forum['commoncredits']);
            } else {
                $_G['forum']['commoncredits']++;
                $forum =& $_G['forum'];
            }
            if (empty($_G['grouplevels'])) {
                loadcache('grouplevels');
            }
            $grouplevel = $_G['grouplevels'][$forum['level']];
            if ($grouplevel['type'] == 'default' && !($forum['commoncredits'] >= $grouplevel['creditshigher'] && $forum['commoncredits'] < $grouplevel['creditslower'])) {
                $levelinfo = C::t('forum_grouplevel')->fetch_by_credits($forum['commoncredits']);
                $levelid = $levelinfo['levelid'];
                if (!empty($levelid)) {
                    C::t('forum_forum')->update_group_level($levelid, $fid);
                    $query = C::t('forum_forumfield')->fetch($fid);
                    $groupfounderuid = $query['founderuid'];
                    notification_add($groupfounderuid, 'system', 'grouplevel_update', array('groupname' => '<a href="forum.php?mod=group&fid=' . $fid . '">' . $forum['name'] . '</a>', 'newlevel' => $_G['grouplevels'][$levelid]['leveltitle'], 'from_id' => 0, 'from_idtype' => 'changeusergroup'));
                }
            }
        }
        dsetcookie('groupcredit_' . $fid, $today, 86400);
    }
}
开发者ID:lemonstory,项目名称:bbs,代码行数:38,代码来源:function_grouplog.php

示例11: 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;
            }
        }
        if ($_G['setting']['connect']['allow'] && !$_G['uid'] && $_G['setting']['security_qqlogin_alone']) {
            $loginboxdisappear = <<<EOF
\t\t\t\t<script type="text/javascript">
\t\t\t\tif(\$('lsform')) {
\t\t\t\t\tvar divs = \$('lsform').getElementsByTagName('div');
\t\t\t\t\tfor(i in divs) {
\t\t\t\t\t\tif(divs[i] && divs[i].className == 'y pns') {
\t\t\t\t\t\t\tdivs[i].style.display = 'none';
\t\t\t\t\t\t}
\t\t\t\t\t\tif(divs[i] && divs[i].className == 'fastlg_fm y') {
\t\t\t\t\t\t\tdivs[i].style.borderWidth = '0px';
\t\t\t\t\t\t}
\t\t\t\t\t}
\t\t\t\t}
\t\t\t\t</script>
EOF;
            if (!(CURMODULE == 'connect' && $_G['connectguest'])) {
                $_G['connect']['referer'] = !$_G['inajax'] && CURSCRIPT != 'member' ? $_G['basefilename'] . ($_SERVER['QUERY_STRING'] ? '?' . $_SERVER['QUERY_STRING'] : '') : dreferer();
                $_G['connect']['login_url'] = $_G['siteurl'] . 'connect.php?mod=login&op=init&referer=' . urlencode($_G['connect']['referer'] ? $_G['connect']['referer'] : 'index.php');
                $loginstr = '<div class="rfm bw0"><table><tr><th>' . lang('plugin/security', 'quicklogin') . ': </th><td><a href="' . $_G['connect']['login_url'] . '&statfrom=login" target="_top" rel="nofollow"><img src="' . IMGDIR . '/qq_login.gif" class="vm" /></a></td></tr></table></div>';
                $loginboxdisappear .= <<<EOF
\t\t\t\t<script type="text/javascript">
\t\t\t\tvar loginform = document.getElementsByTagName('form');
\t\t\t\tif(loginform) {
\t\t\t\t\tfor(i in loginform) {
\t\t\t\t\t\tif(loginform[i].id && loginform[i].id.substr(0, 11) == 'loginform_L') {
\t\t\t\t\t\t\tloginform[i].innerHTML = '{$loginstr}';
\t\t\t\t\t\t}
\t\t\t\t\t}
\t\t\t\t}
\t\t\t\t</script>
EOF;
            }
        }
        if ($_G['setting']['connect']['allow'] && $_G['uid'] && $_G['setting']['security_safelogin'] && !$_G['member']['conisbind'] && CURMODULE != 'post' && getcookie('safelogintips')) {
            $msg = '<p>' . lang('plugin/security', 'safelogintips') . '</p><p class="mtm"><a href="connect.php?mod=config" target="_blank"><img src="' . IMGDIR . '/qq_bind_small.gif" class="qq_bind" align="absmiddle" /></a></p>';
            $safelogintips = <<<EOF
\t\t\t\t<script type="text/javascript">
\t\t\t\thideWindow('safelogintips');
\t\t\t\tshowDialog('{$msg}', 'notice', null, '(function() { window.location.href="connect.php?mod=config"; })();', 0, null, null, null, null, null, null);
\t\t\t\t</script>
EOF;
            dsetcookie('safelogintips');
        }
        return $ajaxReportScript . $ajaxRetryScript . $loginboxdisappear . $safelogintips;
    }
开发者ID:wait121000,项目名称:discuz3.0forsae,代码行数:78,代码来源:security.class.php

示例12: array

        $info['topic'] = $data['topic'];
        if ($_GET['action'] == 'preview') {
            $bbcode->setSmileys($data['dosmileys']);
            if ($config['wordstatus'] == 0) {
                $data['dowords'] = 0;
            }
            $bbcode->setReplace($data['dowords']);
            $data['formatted_comment'] = $bbcode->parse($data['comment']);
        }
    } else {
        $data = array('name' => '', 'email' => '', 'comment' => '', 'dosmileys' => 1, 'dowords' => 1, 'digest' => 0, 'topic' => $lang->phrase('reply_prefix') . $info['topic'], 'human' => null);
        $memberdata_obj = $scache->load('memberdata');
        $memberdata = $memberdata_obj->get();
        // Multiquote
        $qids = $gpc->get('qid', arr_int);
        $pids = getcookie('vquote');
        if (!empty($pids) && preg_match("/^[0-9,]+\$/", $pids)) {
            $qids = array_merge($qids, explode(',', $pids));
            $qids = array_unique($qids);
            makecookie($config['cookie_prefix'] . '_vquote', '', 0);
        }
        if (count($qids) > 0) {
            $result = $db->query('
			SELECT name, comment, guest
			FROM ' . $db->pre . 'replies
			WHERE id IN(' . implode(',', $qids) . ')
			LIMIT ' . $config['maxmultiquote'], __LINE__, __FILE__);
            while ($row = $gpc->prepare($db->fetch_assoc($result))) {
                if ($row['guest'] == 0) {
                    if (isset($memberdata[$row['name']])) {
                        $row['name'] = $memberdata[$row['name']];
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:31,代码来源:addreply.php

示例13: method_3

}
function method_3($n)
{
    $x = $i = 0;
    $s = "";
    $str = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
    while ($i < $n) {
        $x = mt_rand(0, strlen($str));
        $s .= substr($str, $x, 1);
        $i++;
    }
    return $s;
}
function getHashCash($tokenvv)
{
    while (substr(sha1($tokenvv . $s, true), 0, 2) != "og") {
        $s = method_3(16);
    }
    return $s;
}
$sidtoken = ee("becaf9be", base64_decode($json12->data->security->encrypt_string));
$sid = explode("_", $sidtoken)[0];
$token = explode("_", $sidtoken)[1];
$tokenvv = $json10->data->token->vv;
$tokenup = $json10->data->token->up;
$hashcash = getHashCash($tokenvv . "o");
$post = "videoid={$v}&url={$topenlace}&sid={$sid}&referer=null&uid=0&totalseg=&totalsec=&h={$hashcash}&fullflag=0&t={$tokenvv}&ikuflag=u1%5Fm1&source=video";
$call = "http://stat.youku.com/player/addPlayerStaticReport";
$stat = curl_proxy($call, "", "", $headers, 1, $post, 0, $cookie);
$cookie .= getcookie($stat, "_f");
开发者ID:denobisipsis,项目名称:adownloader,代码行数:30,代码来源:youkupartial.php

示例14: array

$_SGLOBAL['tpl_blockvalue'] = array();
$_SGLOBAL['debug_query'] = array();
define('A_DIR', $_SCONFIG['attachmentdir']);
if (substr($_SCONFIG['attachmentdir'], 0, 2) == './' && empty($_SCONFIG['attachmenturl'])) {
    $_SCONFIG['attachmenturl'] = S_URL . substr($_SCONFIG['attachmentdir'], 1);
}
define('A_URL', $_SCONFIG['attachmenturl']);
$newsiteurl = S_URL;
if (strpos($newsiteurl, '://') === false) {
    $newsiteurl = 'http://' . (empty($_SERVER['HTTP_HOST']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST']) . $newsiteurl;
}
define('S_URL_ALL', $newsiteurl);
if (empty($nolanguage)) {
    include_once S_ROOT . './language/main.lang.php';
}
if (file_exists(S_ROOT . './index.html')) {
    define('S_ISPHP', '1');
}
//链接数据库
dbconnect();
if (!defined('IN_SUPESITE_UPDATE')) {
    getcookie();
}
//获取频道信息
$channels = getchannels();
//计划任务
@(include_once S_ROOT . './data/system/cron.cache.php');
if (empty($_SGLOBAL['cronnextrun']) || $_SGLOBAL['cronnextrun'] <= $_SGLOBAL['timestamp']) {
    include_once S_ROOT . './function/cron.func.php';
    runcron();
}
开发者ID:hongz1125,项目名称:devil,代码行数:31,代码来源:common.php

示例15: getAvatar

function getAvatar($profileImg)
{
    if (getcookie('p_avatar') == 'true') {
        return 'img.php?imgurl=' . $profileImg;
    }
    return preg_replace('/https?:\\/\\/\\w+([0-9])\\.twimg\\.com/i', 'https://s3.amazonaws.com/twitter_production', $profileImg);
}
开发者ID:Hircine,项目名称:embrr,代码行数:7,代码来源:twitese.php


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