本文整理汇总了PHP中CValue::cookie方法的典型用法代码示例。如果您正苦于以下问题:PHP CValue::cookie方法的具体用法?PHP CValue::cookie怎么用?PHP CValue::cookie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CValue
的用法示例。
在下文中一共展示了CValue::cookie方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preg_replace
<?php
/**
* $Id$
*
* @category Outils
* @package Mediboard
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision$
* @link http://www.mediboard.org
*/
CCanDo::checkRead();
$session_id = CValue::get("session_id");
$timeout = CValue::get("timeout", 30);
if (!$session_id) {
global $rootName;
$session_name = preg_replace("/[^a-z0-9]/i", "", $rootName);
$session_id = CValue::cookie($session_name);
}
$ip_server = $_SERVER["SERVER_ADDR"];
$smarty = new CSmartyDP();
$smarty->assign("session_id", $session_id);
$smarty->assign("timeout", $timeout);
$smarty->assign("ip_server", $ip_server);
$smarty->display("routage.tpl");
示例2: serverCall
/**
* Send the request on the server
*
* @param String $url URL
* @param String[] $post Parameters POST
*
* @return bool|string
*/
static function serverCall($url, $post = null)
{
CSessionHandler::writeClose();
global $rootName, $version;
$session_name = preg_replace("/[^a-z0-9]/i", "", $rootName);
$cookie = CValue::cookie($session_name);
$result = array("code" => "", "body" => "");
try {
$http_client = new CHTTPClient($url);
$http_client->setCookie("{$session_name}={$cookie}");
$http_client->setUserAgent("Mediboard-" . $version["version"]);
$http_client->setOption(CURLOPT_FOLLOWLOCATION, true);
if ($post) {
$request = $http_client->post(http_build_query($post));
} else {
$request = $http_client->get();
}
} catch (Exception $e) {
CSessionHandler::start();
$result["body"] = $e->getMessage();
return $result;
}
CSessionHandler::start();
$result["code"] = $http_client->last_information["http_code"];
$result["body"] = $request;
return $result;
}
示例3: logAuth
/**
* Log user authentication
*
* @param CUser $user The user logging-in
*
* @return void
*/
static function logAuth(CUser $user)
{
if (!self::authReady() || $user->dont_log_connection) {
return;
}
global $rootName;
$session_name = preg_replace("/[^a-z0-9]/i", "", $rootName);
$app = CAppUI::$instance;
$auth = new self();
$auth->user_id = $user->_id;
$auth->previous_user_id = null;
$auth->auth_method = $app->auth_method;
$auth->datetime_login = CMbDT::dateTime();
$auth->id_address = $app->ip;
$auth->session_id = session_id();
// Screen size
$cookie = CValue::cookie("{$session_name}-uainfo");
$uainfo = stripslashes($cookie);
if ($uainfo) {
$uainfo = json_decode($uainfo, true);
if (isset($uainfo["screen"])) {
$screen = $uainfo["screen"];
$auth->screen_width = (int) $screen[0];
$auth->screen_height = (int) $screen[1];
}
}
// User agent
$user_agent_string = CValue::read($_SERVER, "HTTP_USER_AGENT");
if ($user_agent_string) {
$user_agent = CUserAgent::createFromUA($user_agent_string);
$auth->user_agent_id = $user_agent->_id;
}
$auth->store();
}