How to detect proxy
First of all, to get this script running you need to have PHP installed on your server.
Then in few simple steps you can make your website secure from proxy users.
- Copy this code to the your PHP file:
if ($_SERVER['HTTP_X_FORWARDED_FOR'] || $_SERVER['HTTP_X_FORWARDED'] || $_SERVER['HTTP_FORWARDED_FOR'] || $_SERVER['HTTP_CLIENT_IP'] || $_SERVER['HTTP_VIA'] || in_array($_SERVER['REMOTE_PORT'], array(8080,80,6588,8000,3128,553,554))){
$PROXY=TRUE;
}elseif (file_get_contents("http://dev.dmyip.com/?ip=".$_SERVER[REMOTE_ADDR])=="TRUE"){
$PROXY=TRUE;
}else{
$PROXY=FALSE;
}
- Later in your code you can check if proxy is used simply with:
if ($PROXY) {...}
Script will return TRUE if proxy is detected (or IP is found in blacklist database) or FALSE if is not.
This script wont make your site 100% safe from proxy users, but it will be way more secured than without this script.