Skip to content

Instantly share code, notes, and snippets.

@deivisonarthur
Created July 26, 2012 02:08
Show Gist options
  • Save deivisonarthur/3179838 to your computer and use it in GitHub Desktop.
Save deivisonarthur/3179838 to your computer and use it in GitHub Desktop.
PROXY Detect 2.0
<?php
function proxy_detect ($null) {
$proxyports=array(80,8080,6588,8000,3128,3127,3124,1080,553,554);
for ($i = 0; $i <= count($proxyports); $i++) {
if(@fsockopen($_SERVER['REMOTE_ADDR'],$proxyports[$i],$errstr,$errno,0.5)){
$sockport=true;
}
}
if(
$_SERVER['HTTP_FORWARDED']
|| $_SERVER['HTTP_X_FORWARDED_FOR']
|| $_SERVER['HTTP_CLIENT_IP']
|| $_SERVER['HTTP_VIA']
|| $_SERVER['HTTP_XROXY_CONNECTION']
|| $_SERVER['HTTP_PROXY_CONNECTION']
|| $sockport == true
)
{
return true;
}else{
return false;
}
}
if(proxy_detect($null) == false){
echo 'Nenhum proxy detectado.';
}else{
echo 'Proxy DETECTADO!';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment