Incidentally, you may find this IP gathering function a little more reliable.
PHP Code:
function realIp() {
$ip=FALSE;
if(!empty($_SERVER["HTTP_CLIENT_IP"])) $ip=$_SERVER["HTTP_CLIENT_IP"];
if(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ips=explode(", ", $_SERVER['HTTP_X_FORWARDED_FOR']);
if ($ip) { array_unshift($ips, $ip); $ip = FALSE; }
for ($i = 0; $i < count($ips); $i++) {
if (!eregi ("^(10|172\.16|192\.168)\.", $ips[$i])) {
$ip = $ips[$i];
break;
}
}
}
return ($ip ? $ip : $_SERVER['REMOTE_ADDR']);
}
This function will get the real IP Address, as opposed to the IP address of the transparent proxy that many cable companies force their customers to route through.
How we currently use it:
PHP Code:
<div class="box_general">
<p>To help us resolve the issue that you report, the following information will be sent to the Studio-X Admin team:</p>
<!-- Advise User of Information Being Sent -->
<div class="callout_box">
<?
$ip = realip();
$browser = $_SERVER['HTTP_USER_AGENT'];
if (!$cmd) { $callout_text = "<p>IP Address: $ip</p><p>Browser: $browser</p><p>Member Name: $member_name</p>"; }
else { $callout_text = $redirect_message; }
echo $callout_text;
?>
</div>.....
I can't take credit for the function, it's just something that I picked up from somewhere a while back and now can't live without.
Bookmarks