PHPBuilder - Block an ISP from your site

RSS Twitter

Block an ISP from your site

by: Tim
July 15, 2002

Version: 1.0

Type: Sample Code (HOWTO)

Category: HTTP

License: GNU General Public License

Description: This code blocks an entire ISP (by domain) from your website. This example shows you how to block AOL users from your site.

#This should be at the top of your main "index" page.
#It'll give a fake "404 Not Found" to the browser.

$hn = gethostbyaddr($REMOTE_ADDR);
if (stristr($hn, "")) {
	Header("HTTP/1.1 404 Not Found");
	print "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">
		<TITLE>404 Not Found</TITLE>
		<H1>Not Found</H1>
		The requested URL / was not found on this server.<P>
		<P>Additionally, a 404 Not Found
		error was encountered while trying to use an ErrorDocument to handle the request.
		<ADDRESS>Apache/1.3.26 Server at <your_domain> Port 80</ADDRESS>

Comment and Contribute

Your comment has been submitted and is pending approval.




(Maximum characters: 1200). You have characters left.