hi
i get the IP from $REMOTE_ADDR
how do i strip the ip 202.197.213.176
and get 202.197 from it. i need to block a IP range. which functions to use here ?
thanks in advance kalyan
ereg("([[:digit:]]+).([[:digit:]]+).([[:digit:]]+).([[:digit:]]+)$", $REMOTE_ADDR, $parts);
$parts[1] is 202, $parts[2] is 197,...
What you want here is $parts[1].".".$parts[2]
Slightly simpler:
$aArray = explode('.', $REMOTE_ADDR); echo $aArray[0].'.'.$aArray[1];
One could never guess I just love regular expressions. :-)
Thanks for bringing me back to Earth, vincent.