Sixem

PHP Check If User Is Using Tor

Nov 10th, 2014
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.49 KB | None | 0 0
  1. <?php
  2. function IsTorExitPoint(){
  3. if (gethostbyname(ReverseIPOctets($_SERVER['REMOTE_ADDR']).".".$_SERVER['SERVER_PORT'].".".ReverseIPOctets($_SERVER['SERVER_ADDR']).".ip-port.exitlist.torproject.org")=="127.0.0.2") {
  4. return true;
  5. } else {
  6. return false;
  7. }
  8. }
  9. function ReverseIPOctets($inputip){
  10. $ipoc = explode(".",$inputip);
  11. return $ipoc[3].".".$ipoc[2].".".$ipoc[1].".".$ipoc[0];
  12. }
  13. if (IsTorExitPoint()) {
  14.     echo 'You are using TOR!</br>';
  15. }else{
  16.     echo 'You are NOT using TOR!</br>';
  17. }
  18. ?>
Advertisement
Add Comment
Please, Sign In to add comment