01-04-2016, 07:13 PM
Be careful with PHP Firewall:
The user can easilly change HTTP headers in the request, and put a fake IP, the best is to keep "REMOTE_ADDR". If the user use a proxy and you really want his real IP then keep both. Just keep in mind that the forwarded IP can be faked.
Code:
FUNCTION PHP_FIREWALL_get_ip() {
if ( PHP_FIREWALL_get_env('HTTP_X_FORWARDED_FOR') ) {
return PHP_FIREWALL_get_env('HTTP_X_FORWARDED_FOR');
} elseif ( PHP_FIREWALL_get_env('HTTP_CLIENT_IP') ) {
return PHP_FIREWALL_get_env('HTTP_CLIENT_IP');
} else {
return PHP_FIREWALL_get_env('REMOTE_ADDR');
}
}
The user can easilly change HTTP headers in the request, and put a fake IP, the best is to keep "REMOTE_ADDR". If the user use a proxy and you really want his real IP then keep both. Just keep in mind that the forwarded IP can be faked.