Hello!
This time my problem is that in my webpage I have to ask the user to introduce an ip and a subnetmask, and i need to get the proper subnet, and get validation for some ip ranges, like in a router I'll apreciate some help findding a function that allows me to do that. Thank you.
IPs netmasks and subnets
Moderator: General Moderators
-
tikalacarnes
- Forum Newbie
- Posts: 7
- Joined: Sat May 05, 2007 6:53 pm
are you using php, html or what and if it is php then this should work,
this will at least reveal the ip address of the user now the subnet mask i don't know. I use this code in my site to view who has been there with there ip address.
Code: Select all
if (isset($_SERVER))
{
if (isset($_SERVER["HTTP_X_FORWARDED_FOR"]))
{
$realip = $_SERVER["HTTP_X_FORWARDED_FOR"];
}
elseif (isset($_SERVER["HTTP_CLIENT_IP"]))
{
$realip = $_SERVER["HTTP_CLIENT_IP"];
}
else
{
$realip = $_SERVER["REMOTE_ADDR"];
}
}
else
{
if (getenv('HTTP_X_FORWARDED_FOR'))
{
$realip = getenv('HTTP_X_FORWARDED_FOR');
}
elseif (getenv('HTTP_CLIENT_IP'))
{
$realip = getenv('HTTP_CLIENT_IP');
}
else
{
$realip = getenv('REMOTE_ADDR');
}
}Code: Select all