我正在运行一个投票系统。会话密钥部分是使用浏览器用户代理字符串的哈希生成的。一些用户由于奇怪的用户代理字符串更改而遇到错误,如下面的页面跟踪所示。
在每个页面加载开始时,在 PHP 中的以下庄园中检测到用户代理。
function useragent()
{
static $user_agent = null;
if($user_agent === null)
{
$user_agent = getenv('HTTP_USER_AGENT');
if(empty($user_agent) === true)
{
$user_agent = $_SERVER['HTTP_USER_AGENT'];
}
}
return $user_agent;
}
页面操作跟踪如下。
[2012-09-27 13:20:50] => Array
(
[uri] => /start
[ua] => Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; Sky Broadband; DS_desktopsmiley; GTB7.4; chromeframe/21.0.1180.89; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30618; playbrytetoolbar_playbryte; AskTB5.6; 789905664603; lib/6.02324)
)
[2012-09-27 13:20:50] => Array
(
[uri] => /nominees
[ua] => Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; Sky Broadband; DS_desktopsmiley; GTB7.4; chromeframe/21.0.1180.89; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30618; playbrytetoolbar_playbryte; AskTB5.6; 789905664603; lib/6.02324)
)
[2012-09-27 13:21:10] => Array
(
[uri] => /nominees-save
[post] => Array
(
[category] => talent_show
[talent_show] => 5
)
[ua] => Mozilla/5.0 (Windows NT 6.0; chromeframe/21.0.1180.89) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1
)
[2012-09-27 13:21:10] => Array
(
[uri] => /vote-error
[ua] => Mozilla/5.0 (Windows NT 6.0; chromeframe/21.0.1180.89) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1
)
[2012-09-27 13:21:16] => Array
(
[uri] => /vote-start
[ua] => Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; Sky Broadband; DS_desktopsmiley; GTB7.4; chromeframe/21.0.1180.89; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30618; playbrytetoolbar_playbryte; AskTB5.6; 789905664603; lib/6.02324)
)
我注意到三件事。1)这个人安装了大量的工具栏。2) Chromeframe 已安装。3) MSIE 存在于普通页面上,但不存在于 POST 请求和后续请求中。
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
被添加到 HTML 并返回标题。chromeframe是这里的责任方吗?如果是这样,为什么 chromeframe 会像这样劫持 POST 请求标头?如果不是 chromeframe,为什么会有任何想法?