On Nov 26, 2007 6:08 AM, Jochem Maas [EMAIL PROTECTED] wrote:
Ronald, I really dont care if my email doesn't reach you, making normal
people jump
through hoops because you want to avoid spam is not the right way to do
things,
next time I'll remember not to answer your questions as your not
Ronald Wiplinger wrote:
I use $aa=$_SERVER[REMOTE_ADDR];
and
if(($aa==192.168.2.108) || ($aa==192.168.2.34)) {
$aa=61.64.101.101;// for testing put in a public IP
}
However, I would like to cover all private IPs (192.168.x.x and 10.x.x.x
and 172.??.x.x). How can I do that
Ronald, I really dont care if my email doesn't reach you, making normal people
jump
through hoops because you want to avoid spam is not the right way to do things,
next time I'll remember not to answer your questions as your not going to
['be able to'] read my answers:
BLA BLA BLA
This message
Below is a quick example. This isn't the best way to do it, just
another way. I personally would convert them to integers then compare
instead of doing it the way I'm doing it below.
?php
function privateIP($ip)
{
if ( (($ip = 10.0.0.0) ($ip = 10.255.255.255)) ||
(($ip =
$remoteIP = $_SERVER['REMOTE_ADDR'];
$parts = explode('.', $remoteIP); // Get IP bytes in an array
$isPrivateIP = false;
/* single class A */
$classA = $parts[0] == 10;
/* 16 contiguous class Bs */
$classB = $parts[0] == 172 $parts[1] = 16 $parts[1] = 31;
/* 256 contiguous class Cs */
$classC =
i did this once
$ip = sprintf(%u,intval(ip2long($_SERVER['REMOTE_ADDR'])));
and then did checks to see if it was between the ranges for 10.0.0.0,
192.168 etc...
apparently i lost that code. but it was pretty simple.
http://www.faqs.org/rfcs/rfc1918.html
10.0.0.0- 10.255.255.255
6 matches
Mail list logo