无论出于何种原因,firefox正在删除我的自定义会话变量。这些变量用于内置到自定义主题中的自定义用户系统。这只发生在firefox中,用户系统在所有其他浏览器中都能完美工作。
这是我的页眉顶部。php:
<?php
session_start();
global $errors, $success, $u_cache;
include \'sub-user-auth.php\';
?>
这是子用户身份验证。php:
<?php
$u_cache[\'logged_in\'] = false;
if (!empty($_POST[\'u_signin\']))
{
$errors = array();
$success = \'\';
foreach ($_POST as $k => $v)
$$k = trim(htmlspecialchars($v, ENT_QUOTES));
if (empty($u_username))
$errors[] = \'You must enter your username\';
else if (empty($u_password))
$errors[] = \'You must enter your password\';
else if (mysql_result(mysql_query("select count(*) from `users` where `username`=\'".mysql_real_escape_string($u_username)."\' and `password`=\'".md5($u_password)."\'"), 0) == 0)
$errors[] = \'Invalid username and/or password entered\';
if (empty($errors))
{
foreach ($_POST as $k => $v)
$$k = trim($v);
$_SESSION[\'u_username\'] = $u_username;
$_SESSION[\'u_password\'] = md5($u_password);
if ($u_remember == \'yes\')
{
setcookie(\'u_username\', $u_username, time() + 31536000);
setcookie(\'u_password\', md5($u_password), time() + 31536000);
}
$success = \'You have been signed in successfully! Please <b><a href="\'.get_bloginfo(\'url\').\'/my-home">click here</a></b> to continue to your account.\';
foreach ($_POST as $k => $v)
$$k = \'\';
}
}
if (!empty($_COOKIE[\'u_username\']) && !empty($_COOKIE[\'u_password\']))
{
$u_cache[\'u_username\'] = $_COOKIE[\'u_username\'];
$u_cache[\'u_password\'] = $_COOKIE[\'u_password\'];
}
else if (!empty($_SESSION[\'u_username\']) && !empty($_SESSION[\'u_password\']))
{
$u_cache[\'u_username\'] = $_SESSION[\'u_username\'];
$u_cache[\'u_password\'] = $_SESSION[\'u_password\'];
}
if (!empty($u_cache[\'u_username\']) && !empty($u_cache[\'u_password\']))
{
$sql = mysql_query("select * from `users` where `username`=\'".mysql_real_escape_string($u_cache[\'u_username\'])."\' and `password`=\'".mysql_real_escape_string($u_cache[\'u_password\'])."\'");
if (mysql_num_rows($sql) != 0)
{
while ($row = mysql_fetch_assoc($sql))
{
foreach ($row as $k => $v)
$u_cache[$k] = htmlspecialchars(stripslashes($v), ENT_QUOTES);
}
$u_cache[\'logged_in\'] = true;
$u_cache[\'fav_leagues\'] = explode(\',\', $u_cache[\'fav_leagues\']);
$u_cache[\'fav_teams\'] = explode(\',\', $u_cache[\'fav_teams\']);
}
}
if ($u_cache[\'logged_in\'])
{
if (is_page(array(\'sign-in\', \'sign-up\', \'forgot-password\')))
{
header(\'Location: \'.get_bloginfo(\'url\').\'/my-home\');
die();
}
}
else
{
if (is_page(array(\'my-home\', \'edit-home\', \'sign-out\')))
{
header(\'Location: \'.get_bloginfo(\'url\').\'/sign-in\');
die();
}
}
?>
它允许我登录,显示“我的主页”,然后几乎立即将我踢出,并将我发送回登录页面。将删除所有自定义会话变量。