View Single Post
Old February 28th, 2006, 6:15 PM   #2 (permalink)
mr_fern
All Ur Base R Belong 2 Us
Excelling Contributor
 
mr_fern's Avatar
 
Joined in Feb 2005
Lives in Vegas & New York
824 posts
Gave thanks: 2
Thanked 6 times
Well in php, $_SERVER['REMOTE_ADDR'] is the variable for the visitor's IP

You could basically do at the top of a page

$ip = $_SERVER['REMOTE_ADDR'];
if ( $ip not an allowed ip ) {
header('Location: {uri to plain text optimized page}');
exit;
}

how you want to say that the ip is not an allowed ip is up to you

you might also want to make use of the $_SERVER['HTTP_USER_AGENT'] variable, which gives you the user agent string (i.e. Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) ) which tells you what kind of browser they're using.

Regular search engine bots use they're own user agents, but mischevious bots created by people generally fake user agents, so that's something to consider.

Also, any of the stuff you can accomplish in htaccess over scripting, I would suggest doing that first. It would be less load on the CPU to be handled by htaccess over a script. So use htaccess to do the filtering and then PHP to catch the rest.
__________________
Nobody doing nothing
mr_fern is offline   Reply With Quote