我试图弄清楚为什么Chrome会发生这种情况,而不是FF或IE。 在以下脚本中,$ this-> referrer = $ _SESSION ['URL'];解析为/第一次加载页面时,如果我刷新页面,它会解析为/404.php
function startSession(){
global $database; //The database connection
session_name("Training");
session_start(); //Tell PHP to start the session
/* Determine if user is logged in */
$this->logged_in = $this->checkLogin();
/**
* Set guest value to users not logged in, and update
* active guests table accordingly.
*/
if(!$this->logged_in){
$this->username = $_SESSION['username'] = GUEST_NAME;
$this->userlevel = GUEST_LEVEL;
$database->addActiveGuest($_SERVER['REMOTE_ADDR'], $this->time);
}
/* Update users last active timestamp */
else{
$this->addLogCount($this->id);
$database->addActiveUser($this->username, $this->time);
}
/* Remove inactive visitors from database */
$database->removeInactiveUsers();
$database->removeInactiveGuests();
/* Set referrer page */
if(isset($_SESSION['URL'])){
$this->referrer = $_SESSION['URL'];
}else{
$this->referrer = "/";
}
/* Set current url */
$this->url = $_SESSION['URL'] = $_SERVER['PHP_SELF'];
}
对于FF和IE,它首先解析为/,然后解析为刷新时调用startSession()的页面的地址。 有什么方法可以解决Chrome需要考虑的问题吗?
Chrome中的$ session:
Session Object
(
[id] =>
[tracksid] =>
[username] => Guest
[userid] =>
[userlevel] => 0
[time] => 1297103371
[logged_in] =>
[userinfo] => Array
(
)
[url] => /Community/login.php
[referrer] => /404.php
[type] =>
[company] =>
[ip] =>
[badip] =>
)
FireFox中的$ session:
Session Object
(
[id] =>
[tracksid] =>
[username] => Guest
[userid] =>
[userlevel] => 0
[time] => 1297096106
[logged_in] =>
[userinfo] => Array
(
)
[url] => /Community/login.php
[referrer] => /Community/login.php
[type] =>
[company] =>
[ip] =>
[badip] =>
)
答案 0 :(得分:0)
记录对404.php
的所有访问权限。另请查看访问日志和错误日志。通过这种方式,您知道谁在哪个时间访问了哪个网址(我猜无效网址由404.php
处理)。我怀疑某种类型的Web加速器试图下载不存在的文件,或者HTML中没有指定favicon,因此浏览器会尝试猜测并下载标准文件。