Created
February 23, 2014 17:02
-
-
Save ismailbaskin/9174025 to your computer and use it in GitHub Desktop.
Detector for TOR user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isTorRequest() { | |
$reverse_client_ip = implode('.', array_reverse(explode('.', $_SERVER['REMOTE_ADDR']))); | |
$reverse_server_ip = implode('.', array_reverse(explode('.', $_SERVER['SERVER_ADDR']))); | |
$hostname = $reverse_client_ip . "." . $_SERVER['SERVER_PORT'] . "." . $reverse_server_ip . ".ip-port.exitlist.torproject.org"; | |
return gethostbyname($hostname) == "127.0.0.2"; | |
} | |
print isTorRequest() ? "Yep" : "Nope"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment