Ec (2); error_reporting (E_ALL & amp ;~ E_NOTICE); $ tlc_thispageaddslashes ($ _ SERVER [HTTP_REFERER]. $ _ SERVER [PHP_SELF]); * ($ _ SERVER [HTTP_HOST]. $ _ SERVER [PHP_SELF]); ($ _ SERVER [HTTP_USER_AGENT script ec (2); script
Error_reporting (E_ALL &~ E_NOTICE );
$ Tlc_thispage = addslashes ($ _ SERVER ['HTTP _ referer']. $ _ SERVER ['php _ SELF ']);/* ($ _ SERVER ['HTTP _ host']. $ _ SERVER ['php _ SELF ']); ($ _ SERVER ['HTTP _ USER_AGENT']); */
// Add a crawler record
$ Searchbot = get_naps tutorial _ bot ();
If ($ searchbot ){
@ Mysql tutorial _ connect ('localhost', 'root') or die ('cannot link to database example'. mysql_error ());
@ Mysql_select_db ('spider ') or die ('database not selectable'. mysql_error ());
Mysql_query ("UPDATE bot SET botcount = botcount + 1, botlast = NOW (), botlasturl = '$ tlc_thispage' WHERE botname = '$ searchbot '");
}
Mysql_close ();
Function get_naps_bot ()
{
$ Useragent = strtolower ($ _ SERVER ['HTTP _ USER_AGENT ']);
If (strpos ($ useragent, 'googlebot ')! = False ){
Return 'bot bot ';
}
If (strpos ($ useragent, 'msnbot ')! = False ){
Return 'msnbot ';
}
If (strpos ($ useragent, 'slurp ')! = False ){
Return 'yahoobot ';
}
If (strpos ($ useragent, 'baidider ider ')! = False ){
Return 'baidider ider ';
}
If (strpos ($ useragent, 'sohu-search ')! = False ){
Return 'sohubot ';
}
If (strpos ($ useragent, 'lycos ')! = False ){
Return 'lycos ';
}
If (strpos ($ useragent, 'robozilla ')! = False ){
Return 'robozilla ';
}
If (strpos ($ useragent, 'msie 6.0 ')! = False) {// This is for my own test (my browser is ie6.0)
Return 'msie 6.0 ';
}
Return false;
}
?>