This script in PHP can detect if the user use Tor nework to access to the server.
This script make a request to https://check.torproject.org/cgi-bin/TorBulkExitList.py, hosted by the official Tor Project website. This page give the list of all potential Tor Exit Node which can access to the server.
This script can made the difference between HTTP server which using :80 and HTTPS server which using :443 and adapt his request.
During his first execution, he create the session called "Tor" and store a booleen (true if the IP come from Tor network). If the session already exist, it will skip the test.
This script allow two GET values :
?display=myIP will print the result of the test "My IP (XXX.XXX.XXX.XXX) is NOT Tor Exit Node." or "My IP (XXX.XXX.XXX.XXX) is Tor Exit Node.".
?display=full will print the response of the Tor's website and will display all Tor Exit Node from the past 16 hours that can contact your server address on port 80.
In these two case, it will make a test even if it's not the first execution of the script.
The script will trigger a PHP user Warnig.
Yes. The only information you give to the Tor Website is the IP adress of your server and the port. The check is made on your server.
You have to download Tor.php, it's all.
Yes, since it's published under the MIT licence. If you use this script or have some suggestions, please contact me.