$user_agent = $_SERVER['HTTP_USER_AGENT'];
case (eregi('google',$user_agent)){
echo "Hi GoogleBot";
}
Code:$user_agent = $_SERVER['HTTP_USER_AGENT']; case (eregi('google',$user_agent)){ echo "Hi GoogleBot"; }
This is almost impossible considering the fact that they probably have thousands of IP addresses and changing daily. Why do you want to block it anyway? So it doesn't get indexed?Oops..sorry I should have mentioned in my first post that I needed it to filter by IP address range, rather than just using the User Agent.
I read that Google can crawl using User Agent values like "Mozilla" and "Safari" (without loading images or executing Javascript etc..) to fake that it is a browser, in order to detect cloaking.
This is almost impossible considering the fact that they probably have thousands of IP addresses and changing daily. Why do you want to block it anyway? So it doesn't get indexed?
if you know the IP range that you want to display the backlink to then add a redirect into your htaccess file that redirects IP range 127.0.0 or whatever the range is to a second URL with the backlink. Alternatively use PHP on your landing page:I just want to display a backlink if its a bot indexing the site.
$ip = $_SERVER['REMOTE_ADDR'];
$ip = str_replace(".","",$ip);
$ip_from = "192.168.0.0";
$ip_to = "192.168.255.255";
$ip_from = str_replace(".","",$ip_from);
$ip_to = str_replace(".","",$ip_to);
if ($ip < $ip_from || $ip > $ip_to) { echo "<a href=\"http://link.com\">Anchor</a>"; }
<html>
<body>
<META HTTP-EQUIV="REFRESH" CONTENT=5>
</body>
</html>
I just want to display a backlink if its a bot indexing the site.
Why not use in_array($_SERVER['REMOTE_ADDR'], $googleips)?
This is almost impossible considering the fact that they probably have thousands of IP addresses and changing daily. Why do you want to block it anyway? So it doesn't get indexed?
How came I was not surprised when someone is trying to make money on this?
Top 3 search engines are included in my function, who need other crappy search engines?
Anyone who will take my function in use, i doubt they will pay for fasys when they can enjoy very good free solution![]()