Two part question.
First when I try to echo the Ip address in a hidden input field my form stops submitting. I have jquery to validate some inputs and it all stops when the ip address is present in that field.
Secondly the Ip address I'm getting is not the one I find when I check in terminal. Why is my site, hosted through Godaddy, showing what looks like a proxy ip and not my machine ip?
Here's the code I'm using.
function ipCheck() {
if (getenv('HTTP_CLIENT_IP')) {
$ip = getenv('HTTP_CLIENT_IP');
}
elseif (getenv('HTTP_X_FORWARDED_FOR')) {
$ip = getenv('HTTP_X_FORWARDED_FOR');
}
elseif (getenv('HTTP_X_FORWARDED')) {
$ip = getenv('HTTP_X_FORWARDED');
}
elseif (getenv('HTTP_FORWARDED_FOR')) {
$ip = getenv('HTTP_FORWARDED_FOR');
}
elseif (getenv('HTTP_FORWARDED')) {
$ip = getenv('HTTP_FORWARDED');
}
else {
$ip = $_SERVER['REMOTE_ADDR'];
}
//$ip = str_replace('.','', $ip);
return $ip;
}