本文整理汇总了PHP中Jaws_Utils::getHostReferrer方法的典型用法代码示例。如果您正苦于以下问题:PHP Jaws_Utils::getHostReferrer方法的具体用法?PHP Jaws_Utils::getHostReferrer怎么用?PHP Jaws_Utils::getHostReferrer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jaws_Utils
的用法示例。
在下文中一共展示了Jaws_Utils::getHostReferrer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insert
/**
* insert new session
*
* @access public
* @return mixed Session ID if success, otherwise Jaws_Error or false
*/
function insert()
{
$max_active_sessions = (int) $GLOBALS['app']->Registry->fetch('max_active_sessions', 'Policy');
if (!empty($max_active_sessions)) {
$activeSessions = $this->GetSessionsCount(true);
if ($activeSessions >= $max_active_sessions) {
// remove expired session
$this->DeleteExpiredSessions();
$GLOBALS['app']->Session->Logout();
Jaws_Error::Fatal(_t('GLOBAL_HTTP_ERROR_CONTENT_503_OVERLOAD'), 0, 503);
}
}
// agent
$agent = substr(Jaws_XSS::filter($_SERVER['HTTP_USER_AGENT']), 0, 252);
// ip
$ip = 0;
if (preg_match('/\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b/', $_SERVER['REMOTE_ADDR'])) {
$ip = ip2long($_SERVER['REMOTE_ADDR']);
$ip = $ip < 0 ? $ip + 0xffffffff + 1 : $ip;
}
// referrer
$referrer = Jaws_Utils::getHostReferrer();
$sessTable = Jaws_ORM::getInstance()->table('session', '', 'sid');
if (!empty($GLOBALS['app']->Session->_Attributes)) {
//A new session, we insert it to the DB
$updatetime = time();
$user = $GLOBALS['app']->Session->GetAttribute('user');
$serialized = serialize($GLOBALS['app']->Session->_Attributes);
$sessTable->insert(array('user' => $user, 'type' => JAWS_APPTYPE, 'longevity' => $GLOBALS['app']->Session->GetAttribute('longevity'), 'data' => $serialized, 'referrer' => md5($referrer), 'checksum' => md5($user . $serialized), 'ip' => $ip, 'agent' => $agent, 'createtime' => $updatetime, 'updatetime' => $updatetime));
$result = $sessTable->exec();
if (!Jaws_Error::IsError($result)) {
return $result;
}
}
return false;
}