Re: [PHP] allowing access to php page by IP

From: Chris Boget (chris_at_wild.net)
Date: 10/07/03


To: "Adam Williams" <awilliam@mdah.state.ms.us>, <php-general@lists.php.net>
Date: Tue, 7 Oct 2003 09:38:12 -0500


> certain webpage and keep everyone else out. I have written code to figure
> out what someone's IP is, but am not sure about how I should verify
> whether the IP is in the range of 10.8.4.* or 10.8.5.*. Any suggestions?

$ipArray = explode( '.', $ipAddress );

if(( $ipArray[0] == 10 ) &&
   ( $ipArray[1] == 8 ) &&
   (( $ipArray[2] >=4 ) && ( $ipArray[2] <=5 ))) {
  echo 'Access granted';

} else {
  echo 'Get lost, ya bum!';

}
  
Chris



Relevant Pages

  • Returning a URL from a user search
    ... The companyname and address1 are displaying, ... code to put that webpage in the ... echo htmlspecialchars); ... // display a link to the company's site ...
    (comp.lang.php)
  • Wiki style text input
    ... I have a text file called test.txt which is I am trying to get to load ... into a webpage. ... echo preg_replace; ... Kind regards ...
    (comp.lang.php)
  • Re: Problem while inserting new element in webpage
    ... > I am developing a ToolBand from few days, ... > for inserting the element I have written code like: ... > webpage, its giving error "Invalid target element for this operation". ... Perhaps you want "afterEnd"? ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • Problem while inserting new element in webpage
    ... I am developing a ToolBand from few days, ... for inserting the element I have written code like: ... webpage, its giving error "Invalid target element for this operation". ... Regards, ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • Re: Displaying a date with strtotime
    ... > However, in another part of the webpage, I have to insert another date that ... > may contain a NULL entry in the database. ... if echo date); ...
    (comp.lang.php)