• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getCookie函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: smarty_function_cookie_jar

function smarty_function_cookie_jar($params, $smarty)
{
    if (empty($params['name'])) {
        return;
    }
    return getCookie($params['name']);
}
开发者ID:jkimdon,项目名称:cohomeals,代码行数:7,代码来源:function.cookie_jar.php


示例2: adminDisplayPage

function adminDisplayPage()
{
    $hashUsername = getCookie('ID');
    $check = mysql_query("SELECT * FROM users WHERE sha256_user = '{$hashUsername}'") or die(mysql_error());
    $info = mysql_fetch_array($check);
    $username = $info['username'];
    if ($info['admin'] != 1) {
        header("Location: logout.php");
    }
    echo file_get_contents("admin_header.html");
    //  $online = "online";
    //  $systemCheck = mysql_query("SELECT * FROM system WHERE option = '$online'") or die(mysql_error());
    //  $systemInfo = mysql_fetch_array( $systemCheck );
    //  echo "<form action=\"admin.php\" method=\"POST\">\n";
    //  echo "<input type=\"text\" name=\"offlineData\" value=\"".$systemInfo['data1']."\">\n";
    //  if ($systemInfo['data0'] == "yes")
    //  {
    //    echo "<input type=\"submit\" name=\"offlineDataSubmit\" value=\"Set Offline\">\n";
    //  }
    //  else
    //  {
    //    echo "<input type=\"submit\" name=\"offlineDataSubmit\" value=\"Set Online\">\n";
    //  }
    //  echo "</form>\n";
}
开发者ID:sarahbx,项目名称:moers,代码行数:25,代码来源:admin.php


示例3: smarty_function_debugger

function smarty_function_debugger($params, $smarty)
{
    global $prefs;
    if ($prefs['feature_debug_console'] == 'y') {
        global $debugger;
        require_once 'lib/debug/debugger.php';
        //global $smarty;
        // Get current URL
        $smarty->assign('console_father', $_SERVER["REQUEST_URI"]);
        // Set default value
        $smarty->assign('result_type', NO_RESULT);
        // Exec user command in internal debugger
        if (isset($_REQUEST["command"])) {
            // Exec command in debugger
            $command_result = $debugger->execute($_REQUEST["command"]);
            $smarty->assign('command', $_REQUEST["command"]);
            $smarty->assign('result_type', $debugger->result_type());
            // If result need temlate then we have $command_result array...
            if ($debugger->result_type() == TPL_RESULT) {
                $smarty->assign('result_tpl', $debugger->result_tpl());
                $smarty->assignByRef('command_result', $command_result);
            } else {
                $smarty->assign('command_result', $command_result);
            }
        } else {
            $smarty->assign('command', "");
        }
        // Draw tabs to array. Note that it MUST be AFTER exec command.
        // Bcouse 'exec' can change state of smth so tabs content should be changed...
        $tabs_list = $debugger->background_tabs_draw();
        // Add results tab which is always exists...
        $tabs_list["console"] = $smarty->fetch("debug/tiki-debug_console_tab.tpl");
        ksort($tabs_list);
        $tabs = array();
        // TODO: Use stupid dbl loop to generate links code and divs,
        //       but it is quite suitable for
        foreach ($tabs_list as $tname => $tcode) {
            // Generate href code for current button
            $href = '';
            foreach ($tabs_list as $tn => $t) {
                $href .= ($tn == $tname ? 'show' : 'hide') . "('" . md5($tn) . "');";
            }
            //
            $tabs[] = array("button_caption" => $tname, "tab_id" => md5($tname), "button_href" => $href . 'return false;', "tab_code" => $tcode);
        }
        // Debug console open/close
        //require_once('lib/setup/cookies.php');
        $c = getCookie('debugconsole', 'menu');
        $smarty->assign('debugconsole_style', $c == 'o' ? 'display:block;' : 'display:none;');
        $smarty->assignByRef('tabs', $tabs);
        $js = '';
        if ($prefs['feature_jquery_ui'] == 'y') {
            global $headerlib;
            require_once 'lib/headerlib.php';
            $headerlib->add_jq_onready("\n\$('#debugconsole').draggable({\n\tstop: function(event, ui) {\n\t\tvar off = \$('#debugconsole').offset();\n   \t\tsetCookie('debugconsole_position', off.left + ',' + off.top);\n\t}\n});\ndebugconsole_pos = getCookie('debugconsole_position')\nif (debugconsole_pos) {debugconsole_pos = debugconsole_pos.split(',');}\nif (debugconsole_pos) {\n\t\$('#debugconsole').css({'left': debugconsole_pos[0] + 'px', 'top': debugconsole_pos[1] + 'px'});\n}\n");
        }
        $ret = $smarty->fetch('debug/function.debugger.tpl');
        return $ret;
    }
}
开发者ID:jkimdon,项目名称:cohomeals,代码行数:60,代码来源:function.debugger.php


示例4: setCookieSection

function setCookieSection($name, $value, $section = '', $expire = null, $path = '', $domain = '', $secure = '')
{
    global $feature_no_cookie;
    if ($section) {
        $valSection = getCookie($section);
        $name2 = '@' . $name . ':';
        if ($valSection) {
            if (preg_match('/' . preg_quote($name2) . '/', $valSection)) {
                $valSection = preg_replace('/' . preg_quote($name2) . '[^@;]*/', $name2 . $value, $valSection);
            } else {
                $valSection = $valSection . $name2 . $value;
            }
            setCookieSection($section, $valSection, '', $expire, $path, $domain, $secure);
        } else {
            $valSection = $name2 . $value;
            setCookieSection($section, $valSection, '', $expire, $path, $domain, $secure);
        }
    } else {
        if ($feature_no_cookie) {
            $_SESSION['tiki_cookie_jar'][$name] = $value;
        } else {
            setcookie($name, $value, $expire, $path, $domain, $secure);
        }
    }
}
开发者ID:jkimdon,项目名称:cohomeals,代码行数:25,代码来源:cookies.php


示例5: testServices

 public function testServices()
 {
     $ins = getAuth();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Auth\IAuth::class, $ins);
     $ins = getView();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\View\IView::class, $ins);
     $ins = getLog();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Log\ILog::class, $ins);
     //        $ins = getDB();
     //        $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Database\MedooDB::class, $ins);
     //        $ins = getRedis();
     //        $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Database\PRedis::class, $ins);
     //        $ins = getDataPool();
     //        $this->assertInstanceOf(\Wwtg99\DataPool\Common\IDataPool::class, $ins);
     $ins = getCache();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\Cache::class, $ins);
     $ins = getSession();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\SessionUtil::class, $ins);
     $ins = getCookie();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\CookieUtil::class, $ins);
     $ins = getOValue();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\OldValue::class, $ins);
     $ins = getAssets();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\View\AssetsManager::class, $ins);
     $ins = getMailer();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Utils\Mail::class, $ins);
     $ins = Flight::Express();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Utils\Express::class, $ins);
     $ins = getPlugin('php');
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Plugin\IPlugin::class, $ins);
 }
开发者ID:wwtg99,项目名称:flight2wwu,代码行数:31,代码来源:ComponentTester.php


示例6: chkLogin2

function chkLogin2()
{
    global $db;
    $m_id = getCookie('adminid');
    ckSql($m_id);
    $m_name = getCookie('adminname');
    ckSql($m_name);
    $m_check = getCookie('admincheck');
    ckSql($m_check);
    $index = 'index.php';
    if (strpos($_SERVER['PHP_SELF'], 'editor') > -1) {
        $index = "../" . $index;
    }
    if (!isN($m_name) && !isNum($m_id)) {
        $row = $db->getRow('SELECT * FROM {pre}manager WHERE m_name=\'' . mysql_real_escape_string($m_name) . '\' AND m_id= \'' . $m_id . '\' AND m_status=1');
        if ($row) {
            $loginValidate = md5($row['m_random'] . $row['m_name'] . $row['m_id']);
            if ($m_check != $loginValidate) {
                sCookie('admincheck', '');
                redirect($index . '?m=admin-login', 'top.');
            }
        } else {
            sCookie('admincheck', '');
            redirect($index . '?m=admin-login', 'top.');
        }
    } else {
        redirect($index . '?m=admin-login', 'top.');
    }
}
开发者ID:klarclm,项目名称:sgv,代码行数:29,代码来源:admin_conn.php


示例7: chkLogin

function chkLogin()
{
    global $db;
    $m_id = getCookie("adminid");
    $m_id = chkSql($m_id, true);
    $m_name = getCookie("adminname");
    //	writetofile("operate.log", "loginame:{".$m_name ."};action:{".be("all","action")."};referce:{".getReferer()."}.request:{".$_SERVER["REQUEST_URI"]."};parameters GET:{".json_encode($_GET)."}" );
    writetofile("operate.log", "loginame:{" . $m_name . "};action:{" . be("all", "action") . "};referce:{" . getReferer() . "}.request:{" . $_SERVER["REQUEST_URI"] . "};parameters POST:{" . json_encode($_POST) . "}");
    $m_name = chkSql($m_name, true);
    if (!isN($m_name) && !isN($m_id)) {
        $row = $db->getRow("SELECT * FROM {pre}manager WHERE m_name='" . $m_name . "' AND m_id= '" . $m_id . "' AND m_status ='1'");
        if ($row) {
            $loginValidate = md5($row["m_random"] . $row["m_name"] . $row["m_id"]);
            if (getCookie("admincheck") != $loginValidate) {
                sCookie("admincheck", "");
                die("<script>top.location.href='index.php?action=login';</script>");
            }
        } else {
            sCookie("admincheck", "");
            die("<script>top.location.href='index.php?action=login';</script>");
        }
    } else {
        die("<script>top.location.href='index.php?action=login';</script>");
    }
}
开发者ID:andyongithub,项目名称:joyplus-cms,代码行数:25,代码来源:admin_conn.php


示例8: dispatch

 public function dispatch($action)
 {
     if (!empty($_GET['wid']) and !empty($_GET['hash'])) {
         if (isset($_GET['hash']) && !$this->validateUser($_GET['wid'], $_GET['hash'])) {
             $result = new ResultObj(false, '', 'Invalid User Hash:' . $_GET['hash']);
             echo $result->toJson();
             exit;
         }
         //get hash and compare with $_GET['hahs']
         //if(OK)
         setMyCookie('ugg_wid1', $_GET['wid'], time() + 86400);
     } else {
         if (!empty($_GET['wid'])) {
             $wid = getCookie('ugg_wid1');
             if (!empty($wid) and $wid != $_GET['wid']) {
                 //echo $wid;exit;
                 //return $this->authAction();
             }
         }
     }
     /*//check login status
     		$user = $this->getCurrentUser();
     		if(!$user->isLoggedIn()) {
     			$data['success'] = false;
     			$data['error_code'] = 101;
     			$data['message'] = "请登入";
     			echo json_encode($data);
     			return false;
     		}*/
     return $this->{$action}();
 }
开发者ID:innomative,项目名称:16degrees,代码行数:31,代码来源:iController.php


示例9: getColor

function getColor($name, $default)
{
    if (getCookie($name)) {
        return getCookie($name);
    } else {
        return $default;
    }
}
开发者ID:BGCX261,项目名称:zlbnc-svn-to-git,代码行数:8,代码来源:twitese.php


示例10: __construct

 /**
  * Redefined in order to register cache busters
  *
  * @param class_module_pages_pageelement $objElementData
  */
 public function __construct($objElementData)
 {
     parent::__construct($objElementData);
     //we support ratings, so add cache-busters
     if (class_module_system_module::getModuleByName("rating") !== null) {
         $this->setStrCacheAddon(getCookie(class_module_rating_rate::RATING_COOKIE));
     }
 }
开发者ID:jinshana,项目名称:kajonacms,代码行数:13,代码来源:class_element_news_portal.php


示例11: validateUser

function validateUser()
{
    if (!isValidSessionId(getCookie(COOKIE_SESSION_ID))) {
        setStatus("401", "Unauthorized");
        die;
    } else {
        debug("Validated user");
    }
}
开发者ID:jan-berge-ommedal,项目名称:Thin-PHP-Backend,代码行数:9,代码来源:auth.php


示例12: setDisplayMenu

/**
 * @param $name
 */
function setDisplayMenu($name)
{
    global $smarty;
    if (getCookie($name, 'menu', isset($_COOKIE['menu']) ? null : 'o') == 'o') {
        $smarty->assign('mnu_' . $name, 'display:block;');
        $smarty->assign('icn_' . $name, 'o');
    } else {
        $smarty->assign('mnu_' . $name, 'display:none;');
    }
}
开发者ID:jkimdon,项目名称:cohomeals,代码行数:13,代码来源:tiki-map.php


示例13: isNeedCaptha

 public static function isNeedCaptha()
 {
     if (cmsController::getInstance()->getModule('users')->is_auth()) {
         return false;
     }
     if (getCookie('umi_captcha') == md5(getCookie('user_captcha'))) {
         $_SESSION['is_human'] = 1;
     }
     return getSession('is_human') != 1;
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:10,代码来源:umiCaptcha.php


示例14: syncronizeCookie

function syncronizeCookie($ve3cb9741ffde596f46710a5d7e3ec587, $ve8424b162bf308d1f8a635e40a7ca481)
{
    $v95742520793f25cf843c4ea860507463 = getCookie($ve3cb9741ffde596f46710a5d7e3ec587);
    if ($v95742520793f25cf843c4ea860507463 && !$ve8424b162bf308d1f8a635e40a7ca481) {
        echo "setCookie('{$ve3cb9741ffde596f46710a5d7e3ec587}', '{$v95742520793f25cf843c4ea860507463}');\n";
    }
    if (!$v95742520793f25cf843c4ea860507463 && $ve8424b162bf308d1f8a635e40a7ca481) {
        setcookie($ve3cb9741ffde596f46710a5d7e3ec587, $ve8424b162bf308d1f8a635e40a7ca481, 0, "/");
    }
}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:10,代码来源:cross-domain.php


示例15: check_login

 public final function check_login()
 {
     if (M == 'admin' && C == 'index' && A == 'login') {
         return true;
     } else {
         $userid = getCookie('userid');
         if (!isset($_SESSION['userid']) || !isset($_SESSION['roleid']) || !$_SESSION['userid'] || !$_SESSION['roleid'] || $userid != $_SESSION['userid']) {
             jump('登陆', '?m=admin&c=index&a=login');
         }
     }
 }
开发者ID:iquanxin,项目名称:march,代码行数:11,代码来源:admin.cls.php


示例16: getUserRefer

/**
 * 获取登陆后的转向
 */
function getUserRefer()
{
    global $_FANWE;
    $refer = $_FANWE['request']['refer'];
    $redir_url = getCookie('redir_url');
    if ($redir_url) {
        $refer = $redir_url;
    }
    if (empty($refer)) {
        $refer = FU('u/index');
    }
    return $refer;
}
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:16,代码来源:user.dynamic.php


示例17: displayFeedbackPage

function displayFeedbackPage()
{
    $browser = $_SERVER['HTTP_USER_AGENT'];
    $user_hash = getCookie('ID');
    $check = mysql_query("SELECT * FROM users WHERE sha256_user = '{$user_hash}'") or die(mysql_error());
    while ($info = mysql_fetch_array($check)) {
        echo "<h2>Feedback form:</h2><br />\n";
        echo "I do appreciate all feedback, please just make sure it's constructive. Thank you.<br /><hr /><br />\n";
        echo "<form action=\"feedback.php\" method=\"post\">\n";
        echo "<input type=\"hidden\" name=\"Name\" value=\"" . $info['fname'] . " " . $info['lname'] . "\">\n";
        echo "<input type=\"hidden\" name=\"Username\" value=\"" . $info['username'] . "\">\n";
        echo "<input type=\"hidden\" name=\"Email\" value=\"" . $info['email'] . "\">\n";
        echo "<input type=\"hidden\" name=\"BrowserData\" value=\"{$browser}\">\n";
        echo "<table class=\"transparent\">\n";
        echo "<tr><td>Username:</td><td>" . $info['username'] . "</td></tr>\n";
        echo "<tr><td>Email:</td><td>" . $info['email'] . "</td></tr>\n";
        echo "<tr><td>Operating System:</td><td>\n";
        echo "<select name=\"OperatingSystem\">\n";
        echo "<option value=\"NotSelected\">SELECT</option>\n";
        echo "<option value=\"MacOS\">Mac OS</option>\n";
        echo "<option value=\"Linux\">Linux Variant</option>\n";
        echo "<option value=\"BSD\">BSD Variant</option>\n";
        echo "<option value=\"Windows\">MS Windows</option>\n";
        echo "<option value=\"OtherOS\">Other (Specify)</option>\n";
        echo "</select>\n";
        echo "<input type=\"text\" name=\"OtherOS:\" />\n";
        echo "</td></tr>\n";
        echo "<tr><td>Web Browser:</td><td>\n";
        echo "<select name=\"Browser\">\n";
        echo "<option value=\"NotSelected\">SELECT</option>\n";
        echo "<option value=\"Firefox\">Firefox</option>\n";
        echo "<option value=\"Chrome\">Chrome</option>\n";
        echo "<option value=\"IE\">Internet Explorer</option>\n";
        echo "<option value=\"Safari\">Safari</option>\n";
        echo "<option value=\"Opera\">Opera</option>\n";
        echo "</select>\n";
        echo "</td></tr>\n";
        echo "<tr><td>Feedback Type:</td><td>\n";
        echo "<select name=\"FeedbackType\">\n";
        echo "<option value=\"NotSelected\">SELECT</option>\n";
        echo "<option value=\"BugReport\">Bug Report</option>\n";
        echo "<option value=\"FeatureRequest\">Feature Request</option>\n";
        echo "<option value=\"GeneralComment\">General Comments</option>\n";
        echo "</select>\n";
        echo "</td></tr>\n";
        echo "<tr><td>Feedback:</td><td><textarea name=\"feedback\" rows=\"3\" cols=\"50\"></textarea></td></tr>\n";
        echo "<tr><td></td><td><input type=\"submit\" name=\"submit\" value=\"Submit Feedback\"></td></tr>\n";
        echo "</table>\n";
        echo "</form>\n";
    }
}
开发者ID:sarahbx,项目名称:moers,代码行数:51,代码来源:feedback.php


示例18: chgpwd

function chgpwd()
{
    global $db;
    $oldP = be('all', 'old_pwds');
    $newP = be('all', 'new_pwd');
    $m_name = getCookie("adminname");
    $row = $db->getRow("select m_id from {pre}manager where m_password='" . md5($oldP) . "' and m_name='" . $m_name . "'");
    if (!isN($row['m_id'])) {
        $db->Update("{pre}manager", array('m_password'), array(md5($newP)), "m_name='" . $m_name . "'");
        echo '更新密码成功';
    } else {
        echo '输入的旧密码不对';
    }
}
开发者ID:andyongithub,项目名称:joyplus-cms,代码行数:14,代码来源:admin_forgot_pwd.php


示例19: logoutUser

function logoutUser()
{
    header("Content-Type: text/html; charset=utf-8");
    logLogout(getCookie('ID'));
    if (getCookie('ID')) {
        connectDatabase();
        slashArray($_COOKIE);
        // reset session id
        $sessionId = rand_string(32);
        $update = "UPDATE users SET session_id='{$sessionId}' WHERE sha256_user='" . getCookie('ID') . "'";
        $result = mysql_query($update);
        $sessionId = rand_string(32);
    }
    //this deletes the cookies
    clearCookies();
    header("Location: index.php");
}
开发者ID:sarahbx,项目名称:moers,代码行数:17,代码来源:logout.php


示例20: displayMainPage

function displayMainPage()
{
    $query = "SELECT username, admin FROM users WHERE sha256_user = '" . getCookie('ID') . "'";
    $check = mysql_query($query) or die(mysql_error());
    $info = mysql_fetch_array($check);
    echoMainHeader();
    echo "<div>\n";
    echo "Welcome <b>'" . $info['username'] . "'</b> ";
    if ($info['admin'] == 1) {
        echo " | <a href=\"#\" onClick=\"main_setBodyFrame('body.php')\">Home Page</a>\n";
        echo " | <a href=\"#\" onClick=\"main_setBodyFrame('admin.php')\">Admin Page</a>\n";
    }
    echo "</div>\n";
    echo "<div class=\"class_body\" id=\"div_body\">\n";
    echo "<script language=\"javascript\" type=\"text/javascript\">main_showLoader();</script>\n";
    echo "<iframe class=\"class_iframe_body\" id=\"iframe_body\" src=\"body.php\"></iframe>\n";
    echo "</div>\n";
    echoMainFooter();
}
开发者ID:sarahbx,项目名称:moers,代码行数:19,代码来源:main.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getCorrectUserSalutation函数代码示例发布时间:2022-05-15
下一篇:
PHP getController函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap