So I am working on a project, which is secure, so if the user uses a proxy it will capture the true IP from it. this script should detect it from proxies and shared internet connections (No Idea what they are but hey!) so here is the basic script, tidies into a php function:
<?php
function ip()
{
if (!empty($_SERVER['HTTP_CLIENT_IP']))
{
//shared internet
ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{
//proxy
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
//no proxy?
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}
?>