當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CValue::cookie方法代碼示例

本文整理匯總了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");
開發者ID:fbone,項目名稱:mediboard4,代碼行數:26,代碼來源:routage.php

示例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;
 }
開發者ID:fbone,項目名稱:mediboard4,代碼行數:35,代碼來源:CApp.class.php

示例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();
 }
開發者ID:OpenXtrem,項目名稱:mediboard-test,代碼行數:41,代碼來源:CUserAuthentication.class.php


注:本文中的CValue::cookie方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。