Define (' Isrobot ', Getrobot ()), if (Defined (' Norobot ') && Isrobot) {Exit (header ("http/1.1 403 Forbidden");}
The above code, said to be to prevent the robot access, I do not understand where the representative is the machine person?
Judging the function of the robot is so written, what's the mystery?
function Getrobot () {if (!defined (' Is_robot ')) {$kw _spiders = ' bot| crawl| Spider|slurp|sohu-search|lycos|robozilla '; $kw _browsers = ' msie| netscape| opera| konqueror| Mozilla '; if (Preg_match ("/($kw _browsers)/", $_server[' Http_user_agent ')) {define (' Is_robot ', FALSE);} elseif (Preg_ Match ("/($kw _spiders)/", $_server[' Http_user_agent ')) {define (' Is_robot ', TRUE);} else {define (' Is_robot ', FALSE);}} return Is_robot;}
Reply to discussion (solution)
bot-Microsoft's Bing
spider-Baidu
slurp-Yahoo
The other few do not know, but this can only prevent normal crawling, people who forged or not can not prevent
bot-Microsoft's Bing
spider-Baidu
slurp-Yahoo
The other few do not know, but this can only prevent normal crawling, people who forged or not can not prevent
Isn't there a good one to run?
Rogue to catch also no way, but the general search engine follow robots protocol
Rogue to catch also no way, but the general search engine follow robots protocol
$kw _spiders = ' bot| crawl| Spider|slurp|sohu-search|lycos|robozilla '; What do you mean?
Bot| crawl| Spider|slurp|sohu-search|lycos|robozilla
It's a regular pattern to match.
Bot,spider ... Is a spider's logo, the general search engine will write