a few words about web development

How to detect a proxy in PHP

Another straight to the point solution
Just a simple code snippet which can tell if visitor is using Proxy. Please not that this code might fail to detect anonymous proxies.

if (
	isset($_SERVER['HTTP_X_FORWARDED_FOR']) || 
	isset($_SERVER['HTTP_X_FORWARDED']) || 
	isset($_SERVER['HTTP_FORWARDED_FOR']) || 
	isset($_SERVER['HTTP_VIA']) ||
	in_array($_SERVER['REMOTE_PORT'], array(8080,80,6588,8000,3128,553,554))
	)
	{
		die('Proxy detected');
	}

You can use it to prevent people from registering on your site using different IPs and along with limiting just 1 account per IP you can create a quite efficient "1 account per 1 user" function.

Comments