Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $host = $config['db']['host'];
- $user = $config['db']['username'];
- $pass = $config['db']['password'];
- $database = $config['db']['name'];
- $ua = $_SERVER['HTTP_USER_AGENT'];
- if(stristr($ua, 'msnbot') || stristr($ua, 'googlebot') || stristr($ua, 'Ask Jeeves') || stristr($ua, 'Yahoo! Slurp')){
- //it's pretending to be MSN's bot or Google's bot or yahoo slurp
- $ip = $_SERVER['REMOTE_ADDR'];
- $hostname = gethostbyaddr($ip);
- if(!preg_match("/\.googlebot\.com$/", $hostname) && !preg_match("/\.search\.msn\.com$/", $hostname) && !preg_match("/\.crawl\.yahoo\.net$/", $hostname) && !preg_match("/\.ask\.com$/", $hostname)){
- //the hostname does not belong to either msn.com or googlebot.com or crawl yahoo.
- //Remember the UA already said it is either MSNBot or Googlebot.
- //Fake.
- //echo "Not Allowed";
- //Optional php header 404 page
- header("HTTP/1.1 403 Forbidden");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement