Jump to content

um lil question


BillyBoB

Recommended Posts

Ok, well the short answer is dont. IPs are unreliable and many people's IP address change very regularly. Also, some ISPs force all their clients through a proxy, making all their IPs the same. If you were to ban one person from that ISP, all would be banned.
Link to comment
Share on other sites

You can do if you want to, by putting this code at the top of the page:

[code]<?php
// Array of all IPs blocked, you can get this from a database if you wish
$ips = array("255.255.255.255", "123.45.678.90", "11.111.11.111");

if(in_array($_SERVER['REMOTE_ADDR'], $ips)) {
print("You have been banned from this website and are unable to view it.");
exit();
}
?>[/code]
Link to comment
Share on other sites

[quote author=BillyBoB link=topic=100657.msg397635#msg397635 date=1152958637]
is there an site that i can goto where i can get
info on how to block ips in php script the blocked ips will be in a database
plz tell me thanks
[/quote]

Perhaps the best queston would be, why do you want to ban them?

In regards to the post that talks about how an ISP might change their clients IPs regularly, then you should ask yourself. What are these people doing that makes you want to ban them? 

If they are users on your website. You could block their login username.  If they try to sign up again, you can check to see if they are trying to use the same email address.  Sure people can create multiple email addresses, but then you could just limit the email addresses of your users to that of their ISP (yes I know some ISPs can allow up to 10 emails or even more).

Just some thoughts.  Personally I'd ban the IP.  Another thing I have thought about is banning the ISP.  You do a reverse lookup to see what domain they are from and ban that.  If there are multiple users from the ISP, then you could do a ignore type thing to ignore those who are good.  Then after a while if the trouble seems to calm down you could lift the ISP ban.
This is what we've done on MUDs that I've helped maintain etc.  Though its a bit of a pain if alot of users are from a particular banned ISP.

Link to comment
Share on other sites

Like GingerRobot said above, if you ban an ISP you cna ban thousands of people who havent even been to your website. If they visit they could then have been banned and have not done anything.
Link to comment
Share on other sites

[quote author=BillyBoB link=topic=100657.msg398288#msg398288 date=1153078419]
yea i know but it would keep the speed up on my site cuz i wouldnt have a bunch of slow ppl
[/quote]

Wrong. The speed at which http requests are passed across the internet has nothing to do with the speed of your server. 
Link to comment
Share on other sites

This thread is no longer serving any useful purpose.

I suggest using Google to look for the information you need.  When you have some code written, if you can't get it to work then open a new thread.  Meantime, look at what Gast posted since that will set you on the way.
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.