Jump to content

Php and MySQL Inefficient


Fuzzley

Recommended Posts

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.