View Single Post
Old Oct 14th, 2004, 3:33 AM   #5
Berto
Programming Guru
 
Join Date: Aug 2004
Posts: 1,022
Rep Power: 6 Berto is on a distinguished road
Send a message via AIM to Berto Send a message via MSN to Berto
$agent = $_SERVER['HTTP_USER_AGENT'];
	$guri = $_SERVER['REQUEST_URI'];
	$ip = $_SERVER['REMOTE_ADDR'];
	$url = $_SERVER['PHP_SELF'];
	if(@ereg("Google", $agent)){
   @mysql_query("INSERT INTO googlebot (id, date, uri, agent, ip, url) VALUES ('', now(),'$guri', '$agent', '$ip', '$url')");
	
CREATE TABLE googlebot(
id INT(25) NOT NULL,
date DATETIME NOT NULL,
uri VARCHAR(255) NOT NULL,
agent VARCHAR(255) NOT NULL,
ip VARCHAR(255) NOT NULL,
url VARCHAR(255) NOT NULL,
CONSTRAINT PK PRIMARY KEY (id))

put that code, top part into a php file (preferebly index.php, and the second part is for your datbabase schema if you have one, then you can find out when and how often the googlebot hits your site.
----------------------------------------

note: not 100% sure about the database schema as i cant test it with code already up and running on my database server, but i no the top stuff does work as it was taken wdirectly from my index.php page.
__________________
"Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute. THAT'S relativity."

- Albert Einstein
Berto is offline   Reply With Quote