本文整理汇总了PHP中getCookie函数的典型用法代码示例。如果您正苦于以下问题:PHP getCookie函数的具体用法?PHP getCookie怎么用?PHP getCookie使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getCookie函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_cookie_jar
function smarty_function_cookie_jar($params, $smarty)
{
if (empty($params['name'])) {
return;
}
return getCookie($params['name']);
}
示例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";
}
示例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;
}
}
示例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);
}
}
}
示例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);
}
示例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.');
}
}
示例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>");
}
}
示例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}();
}
示例9: getColor
function getColor($name, $default)
{
if (getCookie($name)) {
return getCookie($name);
} else {
return $default;
}
}
示例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));
}
}
示例11: validateUser
function validateUser()
{
if (!isValidSessionId(getCookie(COOKIE_SESSION_ID))) {
setStatus("401", "Unauthorized");
die;
} else {
debug("Validated user");
}
}
示例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;');
}
}
示例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;
}
示例14: syncronizeCookie
function syncronizeCookie($ve3cb9741ffde596f46710a5d7e3ec587, $ve8424b162bf308d1f8a635e40a7ca481)
{
$v95742520793f25cf843c4ea860507463 = getCookie($ve3cb9741ffde596f46710a5d7e3ec587);
if ($v95742520793f25cf843c4ea860507463 && !$ve8424b162bf308d1f8a635e40a7ca481) {
echo "setCookie('{$ve3cb9741ffde596f46710a5d7e3ec587}', '{$v95742520793f25cf843c4ea860507463}');\n";
}
if (!$v95742520793f25cf843c4ea860507463 && $ve8424b162bf308d1f8a635e40a7ca481) {
setcookie($ve3cb9741ffde596f46710a5d7e3ec587, $ve8424b162bf308d1f8a635e40a7ca481, 0, "/");
}
}
示例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');
}
}
}