Re: RE: How do I ban an ip address please!

From: Date: Fri, 24 Nov 2000 04:07:44 +0000
Subject: Re: RE: How do I ban an ip address please!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-26900@lists.php.net to get a copy of this message
I would say the easiest way to do is this: 1.) a table with IP's only 2.) SELECT * FROM banned_ips WHERE ip='$REMOTE_ADDR'; 3.) if(@mysql_num_rows($result)) Another way is to use a more efficient if(in_array($banned_ips)) Finally, remember that AOL uses LARGE proxies meaning that thousands of users appear to be coming from ONE ip address - you could inadvertantly ban a couple thousand innocent souls. --Joe On Fri, Nov 24, 2000 at 01:02:30PM +1030, Nold, Mark wrote: > ---------------------------------------------------------------------------- > ----------------- > Disclaimer: The information contained in this email is intended only for the > use of the person(s) to whom it is addressed and may be confidential or > contain legally privileged information. If you are not the intended > recipient you are hereby notified that any perusal, use, distribution, > copying or disclosure is strictly prohibited. If you have received this > email in error please immediately advise us by return email at > postmaster@normandy.com.au and delete the email document without making a > copy. > ---------------------------------------------------------------------------- > ----------------- > > I'm sure there are better ways of doing this via your web server, but if you > want to embed it in PHP code try something like: > > > > > $banlist["10.10.1.123"] = true; > $banlist["10.192.1.13"] = true; > $banlist["192.10.1.13"] = true; > $banlist["10.10.1.12"] = true; > $banlist["10.10.1.23"] = true; > $banlist["10.10.100.13"] = true; > > $ip = $GLOBALS["REMOTE_ADDR"]; > if($banlist[$ip] == true){ > echo "You have been banned"; > exit(); > } > > Of course this doesnt allow for patterns like banning a whole subnet etc... > also see how you server returns REMOTE_ADDR in phpinfo() > > Also remember that users may use DHCP which means they have changing IP's... > > > mn > > > > Mark Nold > markn@enspace.com <mailto:markn@enspace.com> > Senior Consultant >   > Change is inevitable, except from vending machines. > > > > -----Original Message----- > From: Sandeep Hundal [mailto:sandeep_wde@yahoo.com] > Sent: Friday, November 24, 2000 10:24 AM > To: php-general@lists.php.net > Subject: How do I ban an ip address please! > > > Hi all, > > I'm using Bare Bones bulletin board, and making something akin my own > version of a message board for articles. I'm tracking all IP > addresses in a mysql column, but would now also like to add in the > ability to ban ip address. > > Any pointers, pieces of code, help etc?? > > thanks! > > > /sunny > > __________________________________________________ > Do You Yahoo!? > Yahoo! Shopping - Thousands of Stores. Millions of Products. > http://shopping.yahoo.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net ================================================================================ = Joe Stump joestump98@yahoo.com http://www.miester.org = ================================================================================ Need a programmer? http://www.google.com/search?q=joe+stump+resume

« previous php.general (#26900) next »