我有一件奇怪的事情发生了,bingbot正在爬行我的网站,其中一个URL看起来像这样:
https://xxxxx/programme.php?action=view&id=2233
在我的代码中,我有这个函数:
function getNumericValue($value) {
if (is_numeric($value)) {
return mysql_escape_string($value);
}
if (isset($_GET[$value])) {
if (!is_numeric($_GET[$value])) {
echo "$value must be numeric.";
exit;
}
return mysql_escape_string($_GET[$value]);
} if (isset($_POST[$value])) {
if (!is_numeric($_POST[$value])) {
echo "$value must be numeric.";
exit;
}
return mysql_escape_string($_POST[$value]);
} else {
echo "Please specify a $value";
debug("Please specify a $value - " .$_SERVER['REQUEST_URI'].' : '.$_SERVER['HTTP_USER_AGENT'].' : '.print_r($_POST, true).' USERID: '.getUserid());
exit;
}}
debug()函数每15分钟向我发送一封错误邮件,当微软爬取站点时,我得到:请指定一个id - /programme.php?action=view&id=2233 : msnbot-NewsBlogs/2.0b (+http://search.msn.com/msnbot.htm):Array () USERID:-1
您可以从URL中看到它有一个id,但是PHP完全忽略了它。这对谷歌蜘蛛来说是很好的。
有什么想法可能会发生什么,以及如何修复它?
发布于 2012-01-12 00:47:17
function getNumericValue($value) {
if (is_numeric($value)) {
return mysql_escape_string($value);
}
if (isset($_REQUEST[$value])) {
$request_value = trim($_REQUEST[$value]);
if (!is_numeric($request_value)) {
echo "$value must be numeric.";
exit;
}
return mysql_escape_string($request_value);
}
echo "Please specify a $value";
debug("Please specify a $value - " .$_SERVER['REQUEST_URI'].' : '.$_SERVER['HTTP_USER_AGENT'].' : '.print_r($_POST, true).' USERID: '.getUserid());
exit;
}https://stackoverflow.com/questions/8822290
复制相似问题