Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. <?php
  2. // PROXY VPN BLOCK : DISABLED
  3.  
  4. function requires curl
  5. function checkProxy($ip){
  6. $contactEmail="admin@discoincasino.me"; //you must change this to your own email address
  7. $timeout=5; //by default, wait no longer than 5 secs for a response
  8. //$banOnProbability=0.79; //if getIPIntel returns a value higher than this, function returns true, set to 0.99 by default
  9.  
  10. //init and set cURL options
  11. $ch = curl_init();
  12. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  13. curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
  14. //if you're using custom flags (like flags=m), change the URL below
  15. curl_setopt($ch, CURLOPT_URL, "https://ip.teoh.io/api/vpn=$ip");
  16. $response=curl_exec($ch);
  17.  
  18. curl_close($ch);
  19.  
  20.  
  21. if ($response > $banOnProbability) {
  22. return true;
  23. } else {
  24. if ($response < 0 || strcmp($response, "") == 0 ) {
  25. //The server returned an error, you might want to do something
  26. //like write to a log file or email yourself
  27. //This could be true due to an invalid input or you've exceeded
  28. //the number of allowed queries. Figure out why this is happening
  29. //because you aren't protected by the system anymore
  30. //Leaving this section blank is dangerous because you assume
  31. //that you're still protected, which is incorrect
  32. //and you might think GetIPIntel isn't accurate anymore
  33. //which is also incorrect.
  34. //failure to implement error handling is bad for the both of us
  35. }
  36. return false;
  37. }
  38. }
  39. $ip=$_SERVER['REMOTE_ADDR'];
  40. if (checkProxy($ip)) {
  41.  
  42. echo "It appears you're a Proxy / VPN / bad IP, please contact [put something here] for more information <br />";
  43. header("Location: https://media.giphy.com/media/YOXkRiVaAvpLTjB5qd/giphy.gif");
  44. exit;
  45. }
  46. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement