how to restrict a page to only a specified ip range in php
Posted
by Mac Taylor
on Stack Overflow
See other posts from Stack Overflow
or by Mac Taylor
Published on 2010-05-15T08:21:01Z
Indexed on
2010/05/15
8:24 UTC
Read the original article
Hit count: 170
php4
hey guys
im looking for a way to restrict my administration page to only my own ip range
concider my ip range is 215.67..
so in php i will begin with this :
$myip = "215.67.*.*";
$myip = explode(".", $my_ip);
$userip = getenv("REMOTE_ADDR") ;
$userip = explode(".", $userip);
if ($myip[0] == $userip[0] AND $myip[1] == $userip[1] ) {
//Contunue admin
}
is there any better and more professional way to do it ?
© Stack Overflow or respective owner