OK, I'm not getting emails yet, and it doesn't redirect to the header location, but I'm not getting errors either...
PHP Code:
<?php
if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown"))
$ip = getenv("HTTP_CLIENT_IP");
else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown"))
$ip = getenv("HTTP_X_FORWARDED_FOR");
else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown"))
$ip = getenv("REMOTE_ADDR");
else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown"))
$ip = $_SERVER['REMOTE_ADDR'];
else
$ip = "unknown";
return($ip);
mail('webmaster@domain.com' , 'The IP Is...', $ip);
header ( "Location: http://www.domain.com/index.htm");
?>
Got this off the php website.... Took the longer one, because it doesn't error out. See
http://us4.php.net/manual/en/function.getenv.php
Bookmarks