Welcome to WebmasterWorld Guest from 50.19.190.144

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Ban IP

with a php script

     
6:39 pm on Feb 11, 2005 (gmt 0)

New User

10+ Year Member

joined:Jan 4, 2005
posts:10
votes: 0


heyz, is it possible for me to block a IP with a script? I searched and searched but don't find anything. can someone help me?

thanks #*$!x

6:42 pm on Feb 11, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:June 17, 2003
posts:107
votes: 0


I use Cpanel for my web hosting accounts and you can use the IP DENY feature.

Check to see if your web hosting account includes a Cpanel and look for IP DENY. It will block as may IP's or IP blocks you like. No coding needed.

6:44 pm on Feb 11, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Jan 17, 2003
posts:1947
votes: 0


$ip = GetHostByName($REMOTE_ADDR);
if ($ip == "theirip") exit;

You can also store the banned IP's in a database and handle it that way.

7:23 pm on Feb 11, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member dreamcatcher is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 30, 2003
posts:3719
votes: 0


If its only a handful of IP addresses that you want to ban, put them in an array and check against that. I use cpanels IP banning feature myself, its very useful.

dc

8:15 pm on Feb 11, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 13, 2003
posts:775
votes: 0


You could use the principles in this Spider Trap [webmasterworld.com] as well.