I am after php code which detects if a user is accessing your site via a proxy server
this is the sort of code I have got.. is there a better way ?
<?php
// start code
// if getenv results in something, proxy detected
if (getenv('HTTP_X_FORWARDED_FOR')) {
$ip=getenv('HTTP_X_FORWARDED_FOR');
}
// otherwise no proxy detected
else {
$ip=getenv('REMOTE_ADDR');
}
// print the IP address on screen
echo $ip;
?>
this is the sort of code I have got.. is there a better way ?
<?php
// start code
// if getenv results in something, proxy detected
if (getenv('HTTP_X_FORWARDED_FOR')) {
$ip=getenv('HTTP_X_FORWARDED_FOR');
}
// otherwise no proxy detected
else {
$ip=getenv('REMOTE_ADDR');
}
// print the IP address on screen
echo $ip;
?>
