[Webmaster_forum] PHP Search Engine Excluder Script
Lt. Julian Fiander, P
webmaster at bpsd9.org
Sun Mar 16 01:26:33 EDT 2008
For anyone who has access to PHP, here is a very simple way to prevent a
search engine from having access to your website:
To add another exclusion setting, add the user-agent name encapsed in single
quotes ( *YES:* *'* *NO:* *"* *or* *`* ) *as it appears* in a
$_SERVER['HTTP_USER_AGENT'] call. This shouldn't be too hard to find out.
Do not change anything that is in *red*.
Place this code AT THE TOP of any page to be protected.**
*NOTE:* Default mode for any non-specified user-agent is ALLOW ACCESS
( Included are a few common search engines. )
Remember, this file is executed on the server, not client. This makes the
entire process totally secure.
********************************************************************************
***
<?php
$agent = strtoupper($_SERVER['HTTP_USER_AGENT']);
**$no_go = array(*'Googlebot','Yahoo','MSN','archiver','Ask','ZyBorg'*);*
*$len = count($no_go);
for ($i=0;$i<$len;$i++) {*
*if (strpos($agent,$no_go[$i])!==FALSE) {die('');}***
*}
?>*****
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.usps.org/pipermail/webmaster_forum/attachments/20080316/cf3a4b7d/attachment-0001.html
More information about the Webmaster_Forum
mailing list