Track proxy traffic in PHP

0
52
PHP

This tutorial explains how to track proxy traffic and protect your website from unwanted traffic in PHP

function block_proxy_visits() {
	
	$headers = array('CLIENT_IP','FORWARDED','FORWARDED_FOR','FORWARDED_FOR_IP','VIA','X_FORWARDED','X_FORWARDED_FOR','HTTP_CLIENT_IP','HTTP_FORWARDED','HTTP_FORWARDED_FOR','HTTP_FORWARDED_FOR_IP','HTTP_PROXY_CONNECTION','HTTP_VIA','HTTP_X_FORWARDED','HTTP_X_FORWARDED_FOR');
	
	foreach ($headers as $header){
		if (isset($_SERVER[$header])) {
			  if(isset($_SERVER['REQUEST_URI']))
                            {
                                $ht_ref=$_SERVER['REQUEST_URI'];
                            }
                            else
                            {
                                $ht_ref="";
                            }
        
                    
                        die();
		}
	}
}

LEAVE A REPLY

Please enter your comment!
Please enter your name here