RewriteEngine on
RewriteCond %{HTTP:VIA} !^$ [OR]
RewriteCond %{HTTP:FORWARDED} !^$ [OR]
RewriteCond %{HTTP:USERAGENT_VIA} !^$ [OR]
RewriteCond %{HTTP:X_FORWARDED_FOR} !^$ [OR]
RewriteCond %{HTTP:PROXY_CONNECTION} !^$ [OR]
RewriteCond %{HTTP:XPROXY_CONNECTION} !^$ [OR]
RewriteCond %{HTTP:HTTP_PC_REMOTE_ADDR} !^$ [OR]
RewriteCond %{HTTP:HTTP_CLIENT_IP} !^$
RewriteRule ^(.*)$ - [F]
and this
/*Anti vpn/proxy checker*/
class Main{
public $_base = "http://whatismyipaddress.com/ip/";
public function _get_ip(){
$forward_check = explode(",",$_SERVER['HTTP_X_FORWARDED_FOR']);
if (!empty($_SERVER['HTTP_CLIENT_IP']))
{
$ip = $_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$ip = $forward_check[sizeof($forward_check)-1];
/*This will always pick the last IP (legit one in the case of using some sort of cdn/proxy) in the X-Forwarded-For */
}
else
{
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
public function _validate(){
global $dbh;
$ip = $this->_get_ip();
$whitelist_check = file_get_contents("./whitelistip.txt");
if(preg_match('/'.$ip.'/'), $whitelist_check);
{
return true;
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->_base . $ip);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.2; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0");
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$reply = strtolower(trim(strip_tags(curl_exec($ch))));
curl_close($ch);
if(!preg_match('/at&t/', $reply))
{
if(preg_match('/type:corporate/', $reply) || preg_match('/hostname:'.$ip.'/', $reply) || substr_count($str,'proxyserver'))
{
return false;
//die("We belive $ip is a Proxy/VPN if you're sure this is not a Proxy / VPN contact support below with the IP address.");
}
if(preg_match('/type:assignment:/', $reply))
{
return false;
//die("We belive $ip is a Proxy/VPN if you're sure this is not a Proxy / VPN contact support below with the IP address.");
}
}
return true;
}
}
?>