Created
July 21, 2022 10:55
-
-
Save LeMiira/f277d89385f24f3771990d71776f10b7 to your computer and use it in GitHub Desktop.
Detect Google Bots
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$remote_add=$_SERVER['REMOTE_ADDR']; | |
$hostname = gethostbyaddr($remote_add); | |
$googlebot = 'googlebot.com'; | |
$google = 'google.com'; | |
if (stripos(strrev($hostname), strrev($googlebot)) === 0 or stripos(strrev($hostname),strrev($google)) === 0 ) | |
{ | |
//add your code | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment