где-то в инете натыкался когда-то на такую функцию для определения IP
CODE:function get_ip()
{
global $HTTP_VIA,
$HTTP_X_COMING_FROM,
$HTTP_X_FORWARDED_FOR,
$HTTP_X_FORWARDED,
$HTTP_COMING_FROM,
$HTTP_FORWARDED_FOR,
$HTTP_FORWARDED,
$REMOTE_ADDR;
if($HTTP_X_FORWARDED_FOR)
{
// case 1.A: proxy && HTTP_X_FORWARDED_FOR is defined
$b = ereg ("^([0-9]{1,3}\.){3,3}[0-9]{1,3}", $HTTP_X_FORWARDED_FOR, $array);
if ($b && (count($array)>=1) )
{
return $array[0];
}
// first IP in the list
else
{
return ( $REMOTE_ADDR . '_' . $HTTP_VIA . '_' . $HTTP_X_FORWARDED_FOR );
}
}
elseif($HTTP_X_FORWARDED)
{
// case 1.B: proxy && HTTP_X_FORWARDED is defined
$b = ereg ("^([0-9]{1,3}\.){3,3}[0-9]{1,3}", $HTTP_X_FORWARDED, $array);
if ($b && (count($array)>=1) )
{
return $array[0];
}
// first IP in the list
else
{
return ( $REMOTE_ADDR . '_' . $HTTP_VIA . '_' . $HTTP_X_FORWARDED );
}
}
elseif($HTTP_FORWARDED_FOR)
{
// case 1.C: proxy && HTTP_FORWARDED_FOR is defined
$b = ereg ("^([0-9]{1,3}\.){3,3}[0-9]{1,3}", $HTTP_FORWARDED_FOR, $array);
if ($b && (count($array)>=1) )
{
return $array[0];
}
// first IP in the list
else
{
return ( $REMOTE_ADDR . '_' . $HTTP_VIA . '_' . $HTTP_FORWARDED_FOR );
}
}
elseif($HTTP_FORWARDED)
{
// case 1.D: proxy && HTTP_FORWARDED is defined
$b = ereg ("^([0-9]{1,3}\.){3,3}[0-9]{1,3}", $HTTP_FORWARDED, $array);
if ($b && (count($array)>=1) )
{
return $array[0];
}
// first IP in the list
else
{
return ( $REMOTE_ADDR . '_' . $HTTP_VIA . '_' . $HTTP_FORWARDED );
}
}
elseif($HTTP_VIA)
{
// case 2:
// proxy && HTTP_(X_) FORWARDED (_FOR) not defined && HTTP_VIA defined
// other exotic variables may be defined
return ( $HTTP_VIA . '_' . $HTTP_X_COMING_FROM . '_' . $HTTP_COMING_FROM );
}
elseif ($HTTP_X_COMING_FROM || $HTTP_COMING_FROM)
{
// case 3: proxy && only exotic variables defined
// the exotic variables are not enough, we add the REMOTE_ADDR of the proxy
return ( $REMOTE_ADDR . '_' . $HTTP_X_COMING_FROM . '_' . $HTTP_COMING_FROM );
}
else
{
// case 4: no proxy
// or tricky case: proxy+refresh
return $REMOTE_ADDR;
}
}