PHP version 5.2.6
MySQL version 5.0.51a
I have this little PHP script to save visitor information:
$dbh = mysql_connect($hostname, $username, $password);
@mysql_select_db($datab);
$time=date("'Y','m','d','l','h','i','s'");
$query = "INSERT INTO $sitename VALUES ('','$ip','$ref','$user_id',$time,'no','no','$proxy','$forp','$via')";
mysql_query($query);
mysql_close($dbh);
The script works fine for regular users. The problem is that it is too slow for bots (search engine crawlers). I'm guessing the bots wait until the page finishes loading. But because the script is slowish (opens database, writes to it, closes it every time) the bots give up. The page that implements the script has even fallen off google's listing. Is there any way to speed up the opening/closing process? Or is there a way to check if the visitor is a bot?
Thanks for any help.