已知IE 8 PHP Session问题? [英] Known IE 8 PHP Session issue?
问题描述
我有一个通过php会话进行身份验证的登录系统。我的客户说现在登录失败,因为我已将网站移动到新服务器。但只有当他使用IE 8.我才能复制这些问题。
I have a login system that is being authenticated via a php session. My client is saying that login is failing now that I have moved the site to a new server. But only when he uses IE 8. I have been unable to replicate these issues.
更令人奇怪的是,这一切都适用于以前的主机。我不知道是浏览器问题,服务器更改还是其他任何问题。
What makes it even more odd is that it all works on the previous host. I am at a loss to whether it is a browser issue, the server change or anything else.
有任何已知问题吗?我认为它可能是一个标题(location:)问题,但它似乎正在以前的主机上工作。
Are there any know issues? I thought it may be a header("location: ") issue, but it seemingly is working on the previous host.
任何帮助表示赞赏
登录代码是这样的(它一直将我的客户端返回到index.php?无效,即使他说他输入的是正确的登录详细信息,我也可以毫无问题地访问。
The login code is this (It keeps returning my client to index.php?invalid even though he says he is entering the correct login details and I am able to access with no problem.
<?php
require('includes/functions.php');
require('includes/db.php');
$user=clean($_POST[user]);
$pass=clean($_POST[pass]);
$qry="SELECT id FROM table WHERE userfield='$user'
AND passwordfield='".md5($pass)."'";
$result=mysql_query($qry);
if(mysql_num_rows($result)>0) {
//Login Successful
//Regenerate session ID to
//prevent session fixation attacks
session_start();
session_regenerate_id();
$result=mysql_fetch_assoc($result);
$_SESSION['USER']=$result['id'];
//Write session to disc
session_write_close();
header("location: success.php");
exit();
}
header("location: index.php?invalid");
?>
推荐答案
是的,IE8会话cookie存在此问题,尤其是使用重定向时。尝试在开始会话之前加入 session_set_cookie_params(0);
- 这将确保会话cookie在浏览器关闭之前不会过期。
Yes, IE8 has this problem with session cookies, especially when redirects are used. Try putting session_set_cookie_params(0);
prior to starting the session - this would ensure that the session cookie will not expire until the browser is closed.
这篇关于已知IE 8 PHP Session问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!