Problem ignoring search bots

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
danf_1979
Forum Commoner
Posts: 72
Joined: Sun Feb 20, 2005 9:46 pm

Problem ignoring search bots

Post by danf_1979 »

Is this code correct?? Want i want to do is to ignore the google and yahoo bots from my web monitor statistics

Code: Select all

$browser = $_SERVER["HTTP_USER_AGENT"];
	if(preg_match ("/Yahoo! Slurp/i", $browser)){;}
	elseif (preg_match ("/Googlebot/i", $type)){;}
	else {
   	sql_query("INSERT INTO $prefix"._monitor." VALUES (\"\",\"$mvname\",".time().",1,0,\"$ipuser \",\"$pais\",\"$urlactual\", \"$monreferer\", \"$browser\")", $dbi);
	insertar($noref);
   	addPais($pais);
	}
}
So what i think this code is doing is:
1-. Get the browser
2-. If its google, do nothing
3-. If its yahoo, do nothing
4-. Complete the insert querys if it is not google or yahoo.

BUT, a minute a go a google bot came in and it didnt work...
danf_1979
Forum Commoner
Posts: 72
Joined: Sun Feb 20, 2005 9:46 pm

Post by danf_1979 »

LOL, what is that $type variable doing there... again LOL. Going to check again if it works now... sorry.
danf_1979
Forum Commoner
Posts: 72
Joined: Sun Feb 20, 2005 9:46 pm

Post by danf_1979 »

Could anybody please connect to my web so i can check if the script process international hits? because -could be the day, but who knows- I suddenly have only national (Chile) hits.
the web is //LINK ERASED// Just to check. I will remove later the link.
Thank u.
And if u connect could you leave a message so i know someone did?? If the script dont get it, then its screwed up.
Thanks asgain.
Last edited by danf_1979 on Mon Jun 13, 2005 2:13 pm, edited 1 time in total.
danf_1979
Forum Commoner
Posts: 72
Joined: Sun Feb 20, 2005 9:46 pm

Post by danf_1979 »

Thank u!! I got someone from this referer. Everyting working fine...
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

glad we could be of service? :roll:
Post Reply