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" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > 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     [EMAIL PROTECTED]
--------------------------------


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to