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


PHP OSCOM::setCookie方法代码示例

本文整理汇总了PHP中osCommerce\OM\Core\OSCOM::setCookie方法的典型用法代码示例。如果您正苦于以下问题:PHP OSCOM::setCookie方法的具体用法?PHP OSCOM::setCookie怎么用?PHP OSCOM::setCookie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在osCommerce\OM\Core\OSCOM的用法示例。


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

示例1: set

 function set($code = null)
 {
     $this->_code = $code;
     if (empty($this->_code)) {
         if (isset($_COOKIE[OSCOM::getSite()]['language'])) {
             $this->_code = $_COOKIE[OSCOM::getSite()]['language'];
         } else {
             $this->_code = $this->getBrowserSetting();
         }
     }
     if (empty($this->_code) || !$this->exists($this->_code)) {
         $this->_code = 'en_US';
     }
     if (!isset($_COOKIE[OSCOM::getSite()]['language']) || $_COOKIE[OSCOM::getSite()]['language'] != $this->_code) {
         OSCOM::setCookie(OSCOM::getSite() . '[language]', $this->_code, time() + 60 * 60 * 24 * 90);
     }
 }
开发者ID:digitaldevelopers,项目名称:oscommerce,代码行数:17,代码来源:Language.php

示例2: set

 public function set($code = null)
 {
     $this->_code = $code;
     if (empty($this->_code)) {
         if (isset($_GET['language'])) {
             $this->_code = $_GET['language'];
         } elseif (isset($_SESSION['language'])) {
             $this->_code = $_SESSION['language'];
         } elseif (isset($_COOKIE['language'])) {
             $this->_code = $_COOKIE['language'];
         } else {
             $this->_code = $this->getBrowserSetting();
         }
     }
     if (empty($this->_code) || $this->exists($this->_code) === false) {
         $this->_code = DEFAULT_LANGUAGE;
     }
     if (!isset($_COOKIE['language']) || $_COOKIE['language'] != $this->_code) {
         OSCOM::setCookie('language', $this->_code, time() + 60 * 60 * 24 * 90);
     }
     if (!isset($_SESSION['language']) || $_SESSION['language'] != $this->_code) {
         $_SESSION['language'] = $this->_code;
     }
 }
开发者ID:digitaldevelopers,项目名称:oscommerce,代码行数:24,代码来源:Language.php

示例3: start

 public static function start()
 {
     Registry::set('Session', SessionClass::load());
     $OSCOM_Session = Registry::get('Session');
     $OSCOM_Session->setLifeTime(SERVICE_SESSION_EXPIRATION_TIME * 60);
     if (SERVICE_SESSION_FORCE_COOKIE_USAGE == '1' || (bool) ini_get('session.use_only_cookies') === true) {
         OSCOM::setCookie('cookie_test', 'please_accept_for_session', time() + 60 * 60 * 24 * 90);
         if (isset($_COOKIE['cookie_test'])) {
             $OSCOM_Session->start();
         }
     } elseif (SERVICE_SESSION_BLOCK_SPIDERS == '1') {
         $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
         $spider_flag = false;
         if (!empty($user_agent)) {
             $spiders = file(OSCOM::BASE_DIRECTORY . 'Core/Site/Shop/assets/spiders.txt');
             foreach ($spiders as $spider) {
                 if (!empty($spider)) {
                     if (strpos($user_agent, trim($spider)) !== false) {
                         $spider_flag = true;
                         break;
                     }
                 }
             }
         }
         if ($spider_flag === false) {
             $OSCOM_Session->start();
         }
     } else {
         $OSCOM_Session->start();
     }
     // verify the ssl_session_id
     if (OSCOM::getRequestType() == 'SSL' && SERVICE_SESSION_CHECK_SSL_SESSION_ID == '1' && OSCOM::getConfig('enable_ssl') == 'true') {
         if (isset($_SERVER['SSL_SESSION_ID']) && ctype_xdigit($_SERVER['SSL_SESSION_ID'])) {
             if (!isset($_SESSION['SESSION_SSL_ID'])) {
                 $_SESSION['SESSION_SSL_ID'] = $_SERVER['SSL_SESSION_ID'];
             }
             if ($_SESSION['SESSION_SSL_ID'] != $_SERVER['SSL_SESSION_ID']) {
                 $OSCOM_Session->destroy();
                 OSCOM::redirect(OSCOM::getLink(null, 'Info', 'SSLcheck', 'AUTO'));
             }
         }
     }
     // verify the browser user agent
     if (SERVICE_SESSION_CHECK_USER_AGENT == '1') {
         $http_user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
         if (!isset($_SESSION['SESSION_USER_AGENT'])) {
             $_SESSION['SESSION_USER_AGENT'] = $http_user_agent;
         }
         if ($_SESSION['SESSION_USER_AGENT'] != $http_user_agent) {
             $OSCOM_Session->destroy();
             OSCOM::redirect(OSCOM::getLink(null, 'Account', 'LogIn', 'SSL'));
         }
     }
     // verify the IP address
     if (SERVICE_SESSION_CHECK_IP_ADDRESS == '1') {
         if (!isset($_SESSION['SESSION_IP_ADDRESS'])) {
             $_SESSION['SESSION_IP_ADDRESS'] = OSCOM::getIPAddress();
         }
         if ($_SESSION['SESSION_IP_ADDRESS'] != OSCOM::getIPAddress()) {
             $OSCOM_Session->destroy();
             OSCOM::redirect(OSCOM::getLink(null, 'Account', 'LogIn', 'SSL'));
         }
     }
     Registry::get('MessageStack')->loadFromSession();
     return true;
 }
开发者ID:digitaldevelopers,项目名称:oscommerce,代码行数:66,代码来源:Session.php


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