Tuesday, March 31, 2015

How to check if client use proxy - PHP Snippet

How to check if client use proxy - PHP Snippet

This php function detect if client is under Proxy or not, if client use proxy will return true.

/***************************************************** 
*
* isProxy
* check whether client is under Proxy or not
* $_SERVER['HTTP_X_FORWARDED_FOR'] is pivotal here
* if client is under Proxy, returns true
* if client is not under Proxy, returns false
*
*****************************************************/

function isProxy(){
return (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) ? true : false;
}
Disqus Comments