note 72698 added to reserved.variables
| From: | borg at sven-of-nine dot de | Date: | Tue, 30 Jan 2007 11:22:59 +0000 |
| Subject: | note 72698 added to reserved.variables | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-122347@lists.php.net to get a copy of this message | ||
Simple function to determine if a visitor is an agent or not
function isbot($agent="")
{
//Handfull of Robots
$bot_array =array("jeevesteoma",
"msnbot",
"slurp",
"jeevestemoa",
"gulper",
"googlebot",
"linkwalker",
"validator",
"webaltbot",
"wget");
//no agent given => read from globals
if ($agent=="")
{
@$agent=$_SERVER["HTTP_USER_AGENT"];
}
//replace all but alpha
$agent=strtolower(preg_replace("/[^a-zA-Z _]*/","",$agent));
//check für intersections
return((BOOL)count(array_intersect(explode(" ",$agent),$bot_array)));
}
----
Server IP: 69.147.83.197
Probable Submitter: 87.167.211.101
----
Manual Page -- http://www.php.net/manual/en/reserved.variables.php
Edit -- https://master.php.net/note/edit/72698
Del: integrated -- https://master.php.net/note/delete/72698/integrated
Del: useless -- https://master.php.net/note/delete/72698/useless
Del: bad code -- https://master.php.net/note/delete/72698/bad+code
Del: spam -- https://master.php.net/note/delete/72698/spam
Del: non-english -- https://master.php.net/note/delete/72698/non-english
Del: in docs -- https://master.php.net/note/delete/72698/in+docs
Del: other reasons-- https://master.php.net/note/delete/72698
Reject -- https://master.php.net/note/reject/72698
Search -- https://master.php.net/manage/user-notes.php