How To Block IP Address with PHP scripts
February 7th, 2008 by | Filed under Uncategorized.
i actually do this to my site ,i block some refferer IP address in my country because i’d like to know how if i block it
[i can't tell you why],if you want to block some refferer IP address or certain IP address or a subnet.we can use several scripts to do this.but because my site is php.so i use php scripts to blocks IP address. here is the scripts :
<?
$targetAddr = "202.46.129..*"; //yes is two dots\
$targetAddr2 = "222.124.224.147" ;
if (ereg($targetAddr, $_SERVER['REMOTE_ADDR']) ||
ereg($targetAddr2, $_SERVER['REMOTE_ADDR']))
{
//remote address match, do something or don't do anything
header( 'Location: http://backtracktutorial.com' ) ;
}
?>
the blocked IP is 202.46.129.0\24 and 222.124.224. 147 and if this IP address open my site it will redirect to http://backtracktutorial.com. you can use and change this script.put it at header of your site (header.php).and and the blocked IP will redirect into another site. or you can left a massage.
but you need to know that the blocked pages is the front page.the main index template.you still can acces your wp-admin so you still can edit or post at your website like what i do.:D
- How Get Free Rapidshare Premium Account in Net
because my premium account will expired this month so i try to googling how to get free rapidshare…
- Convert PHP Exploit to an .exe
when i searching a video tutorial at my downloaded file. i found something good. i forget when i …
- Rooting PHPMyadmin with Google Dork and Spawn a Shell [Repost]
i saw a video that teach how to spawn a shell via phpMyadmin,but there is some problem how can i fin…
- Find your Ultimate CGI Proxy using Google Dork
- OWASP WebGoat Project help you how to become Great Hacker
[Read the rest on (it)gossips network: admin]
Subscribe to Our FREE Newsletter Now:
Subscribe Feed (RSS)






































Add New Comment
Viewing 4 Comments
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Add New Comment
Trackbacks
(Trackback URL)