开发者

PHP tracking outgoing link but execlude bots? And a small if statement question

开发者 https://www.devze.com 2023-03-16 01:36 出处:网络
I\'m making a script, where i want track the unique clicks on the outgoing links e.g. \"out.php?id=1\" (its a php header redirect).

I'm making a script, where i want track the unique clicks on the outgoing links e.g. "out.php?id=1" (its a php header redirect).

but I don't want track the hits from the spider crawlers? Should i do a simple preg_match('/google|yahoo/') or something ? What would be the best solution?

Than i have a question about a statement i have following d开发者_开发技巧ata in the table

IP - DOMAIN 
127.0.0.1 Google.com

Now i want if 127.0.0.1 clicks a link on my page and it dont goes to google.com it should get counted.

than the table would look

IP - DOMAIN
127.0.0.1 GOOGLE.com
127.0.0.1 yahoo.com

Sorry im thinking all the day about the statement, how to do it, but i don't get it =) sorry I just learned / learning coding.


One option might be to just add your out.php (or whatever you end up calling the redirect file) to robots.txt. Otherwise you'll probably have to resort to sniffing $_SERVER["HTTP_USER_AGENT"] as you suggested yourself.

0

精彩评论

暂无评论...
验证码 换一张
取 消