本文整理汇总了PHP中session::get_http_referer方法的典型用法代码示例。如果您正苦于以下问题:PHP session::get_http_referer方法的具体用法?PHP session::get_http_referer怎么用?PHP session::get_http_referer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类session
的用法示例。
在下文中一共展示了session::get_http_referer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_visitor_log
public static function update_visitor_log($uid, $force_update = false)
{
$http_referer = session::$db->escape(session::get_http_referer());
$user_agent = session::$db->escape(session::get_user_agent());
$ip_address = session::$db->escape(get_ip_address());
if (!($forum_fid = get_forum_fid())) {
$forum_fid = 0;
}
$current_datetime = date(MYSQL_DATETIME, time());
$uid = is_numeric($uid) && $uid > 0 ? session::$db->escape($uid) : 'NULL';
if (!($search_id = session::is_search_engine())) {
$search_id = 'NULL';
}
if (!$force_update) {
$sql = "SELECT UNIX_TIMESTAMP(MAX(LAST_LOGON)) FROM VISITOR_LOG WHERE FORUM = {$forum_fid} ";
$sql .= "AND ((UID = {$uid} AND {$uid} IS NOT NULL) OR (SID = {$search_id} AND {$search_id} IS NOT NULL) ";
$sql .= "OR (IPADDRESS = '{$ip_address}' AND {$uid} IS NULL AND {$search_id} IS NULL))";
if (!($result = session::$db->query($sql))) {
return false;
}
list($last_logon) = $result->fetch_row();
}
if (!isset($last_logon) || $last_logon < time() - HOUR_IN_SECONDS) {
$sql = "REPLACE INTO VISITOR_LOG (FORUM, UID, LAST_LOGON, IPADDRESS, REFERER, USER_AGENT, SID) ";
$sql .= "VALUES ('{$forum_fid}', {$uid}, CAST('{$current_datetime}' AS DATETIME), '{$ip_address}', ";
$sql .= "'{$http_referer}', '{$user_agent}', {$search_id})";
if (!session::$db->query($sql)) {
return false;
}
}
return true;
}
示例2: gettext
$error_msg_array[] = gettext("Passwords do not match");
$valid = false;
}
if (mb_strtolower($logon) == mb_strtolower($password)) {
$error_msg_array[] = gettext("Username and password must be different");
$valid = false;
}
}
if ($valid) {
if (user_exists($logon)) {
$error_msg_array[] = gettext("Sorry, a user with that name already exists");
$valid = false;
}
}
if ($valid) {
$user_data = array('IPADDRESS' => get_ip_address(), 'REFERER' => session::get_http_referer(), 'LOGON' => $logon, 'NICKNAME' => $nickname, 'EMAIL' => $email);
if (ban_check($user_data)) {
$error_msg_array[] = gettext("The username or password you supplied is not valid.");
$valid = false;
}
}
if ($valid) {
if (($new_uid = user_create($logon, $password, $nickname, $email)) !== false) {
// Save the new user preferences
user_update_prefs($new_uid, $new_user_prefs);
// Save the new user signature
user_update_sig($new_uid, $sig_content, true);
// Initialise the new user session.
session::start($new_uid);
// Update User's last forum visit
forum_update_last_visit($new_uid);
示例3: refresh
public static function refresh($uid)
{
$ip_address = get_ip_address();
$http_referer = session::get_http_referer();
if (!($forum_fid = get_forum_fid())) {
$forum_fid = 0;
}
if (!($user = user_get($uid))) {
$user = array('UID' => 0, 'LOGON' => 'GUEST', 'NICKNAME' => 'Guest', 'EMAIL' => '');
}
unset($user['IPADDRESS'], $user['PASSWD'], $user['REFERER']);
$_SESSION = array_merge($_SESSION, $user);
$_SESSION['FID'] = $forum_fid;
$_SESSION['IPADDRESS'] = get_ip_address();
if (session::logged_in() && ($user_prefs = user_get_prefs($uid))) {
$_SESSION = array_merge($_SESSION, $user_prefs);
}
if ($user_perms = session::get_perm_array($uid, $forum_fid)) {
$_SESSION['PERMS'] = $user_perms;
}
if (!isset($_SESSION['REFERER'])) {
$_SESSION['REFERER'] = session::get_http_referer();
}
if (!isset($_SESSION['RAND_HASH'])) {
$_SESSION['RAND_HASH'] = md5(uniqid(mt_rand()));
}
if (isset($user_prefs['STYLE'])) {
html_set_cookie("forum_style", $user_prefs['STYLE'], time() + YEAR_IN_SECONDS);
}
}