我来回答你,记得及时结贴给分哦。 index.php里有require("a.php");这条语句,而a.php里有header("location:index.php");。
则和index.php里有header("location:index.php");没什么不同,当浏览index.php时造成了一个死循环。相当于:
index.php
<?php
Header("Location: index.php");
// other code
?>
a.php里可能应当有如下语句。(在“Header("Location: index.php");”这条语句前必须有判断语句)if (stristr($_SERVER['SCRIPT_NAME'], "functions.php")) {
Header("Location: index.php");
die();
}具体情况如何你应当把Header("Location: index.php");前后的语句也贴出来。我给你看看。
则和index.php里有header("location:index.php");没什么不同,当浏览index.php时造成了一个死循环。相当于:
index.php
<?php
Header("Location: index.php");
// other code
?>
a.php里可能应当有如下语句。(在“Header("Location: index.php");”这条语句前必须有判断语句)if (stristr($_SERVER['SCRIPT_NAME'], "functions.php")) {
Header("Location: index.php");
die();
}具体情况如何你应当把Header("Location: index.php");前后的语句也贴出来。我给你看看。
if (!eregi("index.php",$SCRIPT_NAME) && !$user_online){
if (eregi("/tools",$SCRIPT_NAME))
header("location:../index.php");
else
header("location:index.php");
die();
}
以上$user_online是个session变量,在user登录以后会赋值。“/tools”是网站中的一个子目录。
!$user_online 判断用户是否已经登录。//** 当且仅当发现黑客企图且客户端为未登录用户时********
if (!eregi("index.php",$SCRIPT_NAME) && !$user_online){//******************重定向到index.php******************
if (eregi("/tools",$SCRIPT_NAME))
header("location:../index.php");
else
header("location:index.php");
die();
//*****************************************************
}你可以在a.php中插入如下语句来判断//判断$user_online是否有效赋值
echo "user_online is ".$user_online;
if (!eregi("index.php",$SCRIPT_NAME) && !$user_online){
if (eregi("/tools",$SCRIPT_NAME))
header("location:../index.php");
else
header("location:index.php");
die();
}
如果察看显示页面的源码里肯定没有user_online is “值”。
这是因为你的$user_online未被定义或不是全局有效。
如果说在前一个服务器正常(你未作任何改动)那么很可能是服务器session设置的问题,如果是这种情况,应当无法正常登录或即使登录功能也不完整才对。 建议你顺藤摸瓜对$user_online的值进行跟踪,确认是session无效后,检查服务器设置。我居然打字打了这么多,ho ho ho
不该省的地方别省。打开register_globals的话会有很多麻烦的。