本文整理汇总了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);
}
}
示例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;
}
}
示例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;
}