PDA

View Full Version : How does IP banning work?


Pixolet
Tue 4th Jun '02, 6:30am
I want to be able to ban people from a site using their IP.
How can this be done?

I was under the impression that the ip changes when ever you reconnect to the web- hence ip banning dosn't work. But I saw it can be doen in VB, so I wondered how it works here.

mcncyo
Tue 4th Jun '02, 7:03am
most users does change there ip address when they log out of the net. You could just block all ip address in the block. for an example my ip address 255.255.255.3 to block me you will type in 255.255.255

it would block me only if i can't get an ip address out of the 255.255.255.1-255 range. You might have to block more, but the more you block the less people can access your forum.

megahard
Tue 4th Jun '02, 10:31am
ppl on permanent connections often only have 1-4 IPs tops, so u can ban them.

Dan615
Tue 4th Jun '02, 10:12pm
As far as I know, PHP versions before 4.1 use $REMOTE_ADDR, or $HTTP_SERVER_VARS['REMOTE_ADDR'] to reference the user's IP, and in PHP 4.1 and above it's referenced as $REMOTE_ADDR if register_globals is enabled, and $_SERVER['REMOTE_ADDR'] if not. So, a sample thingy that checks if a user is banned could be:



$version = intval(str_replace(".", "", phpversion()));
if ($version < 410) { // if php version is older than 4.1
$_SERVER = &$HTTP_SERVER_VARS; // reference to server variables array
}
$ip_addr = $_SERVER['REMOTE_ADDR'];

$result = mysql_query("select * from ip_ban_list where ip_addr = \"$ip_addr\"") or die(mysql_error()); // get the rows matching that IP

if (mysql_num_rows($result) != 0) { // if it finds the IP...
die("You're banned..."); // kill the script, and say they're banned
}

// carry on as usual

Zoombie
Wed 5th Jun '02, 12:47am
If you're banning IPs by hand, it's pretty easy to edit the .htaccess file:
<LIMIT GET POST>
ORDER Allow,Deny
Allow from All
Deny from {ip address}
</LIMIT>

ccd2
Mon 10th Jun '02, 11:49am
Yes, problem with banning people on dynamic IP's is that they change all the time and if you ban by range, you risk banning a lot more users than just the one you are concerned with. I, for instance, only have five IP's to chose from--maybe if a new standard was developed where everyone was designated their own address and they stuck to it for life? Like a social security type thing for internet affairs.

andrewpfeifer
Mon 10th Jun '02, 11:59am
I can't see that ever happening, it just wouldn't work out. It would be a nice thing, though.

Dan615
Mon 10th Jun '02, 2:21pm
Who knows, that might be part of the web's remodeling that's happening right now...

TalonKarrde
Thu 13th Jun '02, 11:07am
Most broadband users have "static" ip addies, meaning they don't change.

Most dialup users have "dynamic" ip addies, meaning they do.

IP banning works best with static, but as posted before, you can IP ban Dynamic too

ccd2
Thu 13th Jun '02, 11:34am
Actually, most broadband users have dynamic IP's, using protocols such as PPPoE on DSL.

irc
Mon 24th Jun '02, 9:55am
That is not the case in New York. My cable is static, and at work we use DSL and we are also static there.

Gary King
Tue 25th Jun '02, 3:20pm
You can also just simply use a web proxy to change your IP, and be able to axx boards even though the admin has banned you. This will cause many problems for boards, as you might have guessed.

uranusalien
Mon 1st Jul '02, 6:50pm
OK, OK, let's get this clear...

>> People with 'always-on', (broadband/fast) internet connections, tend to always have the same IP (i.e. static).

>> People with 'dialup', tend to change their IP each time they connect to the 'net.

>> If you have a dynamic IP and you need a static one, try dns2go.com. It provides you with a web address that can always reach you at your current IP address (useful if you want to run webservers, etc.)

Gary King
Mon 1st Jul '02, 7:07pm
Originally posted by uranusalien
OK, OK, let's get this clear...

>> People with 'always-on', (broadband/fast) internet connections, tend to always have the same IP (i.e. static).

>> People with 'dialup', tend to change their IP each time they connect to the 'net.

>> If you have a dynamic IP and you need a static one, try dns2go.com. It provides you with a web address that can always reach you at your current IP address (useful if you want to run webservers, etc.)

Yes, that is correct :)

Meirion
Fri 5th Jul '02, 5:48am
Originally posted by uranusalien
OK, OK, let's get this clear...
<snip>
>> If you have a dynamic IP and you need a static one, try dns2go.com. It provides you with a web address that can always reach you at your current IP address (useful if you want to run webservers, etc.)

yes but you can't use this to browse from, as such. So as far as the VB's you visit are concerned you will still be on a dynamic IP.

Simple way to get around people using free web proxies like anonymiser etc... just ban the proxy servers by IP. Anyone who is trying to access your boards through them is probably trying to hide from you, so you're not keeping real users away. (well maybe a couple of paranoid ones but they should lighten up!)