|
Posted by fletch on 04/12/06 13:13
I'll gve you a bit, but not all becasue it belongs to the company I
work for, I know he won't mind if I give a bit, but only if I plug the
company as well. Contact Zedcore Systems Ltd for php development!
if (isset($_SERVER['HTTP_USER_AGENT']))
{
$aSpiderUAs =
array(16=>'abachobot',11=>'abcdatos',3=>'altavista',9=>'antibot',29=>'arach',6=>'archiver',7=>'asterias',8=>'atomz',4=>'crawler',10=>'ezresult',2=>'fast',12=>'ferret',13=>'find',14=>'fireball',15=>'geckobot',1=>'google',17=>'gulliver',18=>'hubater',19=>'incywincy',20=>'infoseek',21=>'mercator',38=>'msnbot',22=>'nazilla',23=>'roach',24=>'robot',25=>'scooter',26=>'scrubby',27=>'sightquest',28=>'slurp',5=>'spider',30=>'spyder',31=>'teoma',32=>'toutatis',33=>'ultraseek',34=>'webrefiner',35=>'wscbot',36=>'yandex',37=>'zyborg');
$sHTTPUserAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
foreach($aSpiderUAs as $iPos=>$sSpiderUA)
{
if (strpos($sHTTPUserAgent,$sSpiderUA)!==false)
{
$iSpiderID = $iPos;
$sSID = $iSpiderID.'00000000';
$bCaughtASpider = true;
}
}
}
if (!$bCaughtASpider)
{
do {
$sNewSID = md5(mt_rand().mt_rand()); // An MD5 hash is 32 chars, the
same as a PHP-generated SID;
} while (file_exists(ini_get('session.save_path').'/sess_'.$sNewSID));
$sSID = $sNewSID;
}
The rest is left as an excercise for the reader!
Navigation:
[Reply to this message]
|