PDA

View Full Version : Follow up to: Is this PHP script safe?



samp
02-05-2004, 02:38 PM
This script reports a googlebot visit to a page with this format: page_name.php.

When it reports a visit to a page in the format: page_name.php?offset=10 it does not report the actual page with the parameter: page_name.php?offset=10, just: page_name.php.

Any ideas on how to correct this error? It would be helpful to have the *actual page* visited reported back.
(Am aware that the server logs are available.)

Here's the script again:

<?php
if (strstr($_SERVER['HTTP_USER_AGENT'], "Googlebot")) {
$body = "Googlebot just visited this page: " . $_SERVER["PHP_SELF"];
mail("My_email_address", "Google Alert " . $_SERVER["PHP_SELF"], $body);
};
?>

Thanks for any suggestions.

jalal
02-05-2004, 03:07 PM
Hmmm, you probably need to add:
$_SERVER['QUERY_STRING'] to the string.

samp
02-06-2004, 04:52 AM
Thanks jalal -

The 'QUERY_STRING' worked fine.