Re: Restricting access using IPs

From: Date: Sat, 13 Jul 2002 18:11:51 +0000
Subject: Re: Restricting access using IPs
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-107502@lists.php.net to get a copy of this message
Oops, wrong variable. That should be: $substring = substr($REMOTE_ADDR,0,9); if ($substring == '192.168.0') { // you're in } Michael > On Sat, 13 Jul 2002, Liam MacKenzie wrote: > > > If I enter 192.168.0.13 (My IP) it works, I'm allowed in and any other IP > > isn't. > > However, I need to grant access to this whole network, not just me. So I > > need 192.168.0.* to be able to access it, everyone else should get "Access > > Denied" > > > > So I need to know how to write this bit: > > $localip = "192.168.0.13"; > > so that it's the network, not just me. > > > > I tried these but they didn't work: > > $localip = "192.168.0.0"; > > $localip = "192.168.0.*"; > > $localip = "192.168.0.0/24"; > > > > > > Any other ideas? > > > > Cheers > > > > > > > > ----- Original Message ----- > > From: "Jason Wong" <php-general@gremlins.com.hk> > > To: <php-general@lists.php.net> > > Sent: Saturday, July 13, 2002 3:49 PM > > Subject: Re: [PHP] Restricting access using IPs > > > > > > > On Saturday 13 July 2002 13:10, Liam MacKenzie wrote: > > > > Hey all, I'm looking to deny access to all IPs except those that fall > > into > > > > a specific IP range. 192.168.0.* in this case. > > > > Am I missing something out of this code, it don't work too well ;-) > > > > > > HOW doesn't it work too well? It displays a picture of a naked guy instead > > of > > > the naked girl that you was expecting? > > > > > > > <? > > > > $localip = "192.168.0.13"; > > > > if ($REMOTE_ADDR == $localip) { > > > > ?> > > > > > > > > Allowed! > > > > > > > > <? > > > > } > > > > else { > > > > ?> > > > > > > > > Denied! > > > > > > > > <? > > > > } > > > > > > > > ?> > > > > > > > > > -- > > > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > > Open Source Software Systems Integrators > > > * Web Design & Hosting * Internet & Intranet Applications Development * > > > > > > /* > > > GOOD-NIGHT, everybody ... Now I have to go administer FIRST-AID to my > > > pet LEISURE SUIT!! > > > */ > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > > > -- -------------------------------- n i n t i . c o m php-python-perl-mysql-postgresql -------------------------------- Michael Hall ninti@ninti.com --------------------------------

« previous php.general (#107502) next »