cyberline/tor-detect

Class to determine if Remote User is using the TOR Network

v1.2 2017-03-20 14:41 UTC

This package is auto-updated.

Last update: 2024-04-29 03:18:06 UTC


README

Scrutinizer Code Quality Build Status SensioLabsInsight Latest Stable Version Total Downloads Latest Unstable Version License

Tor is collaborative network that allows people to access sites hiding their original IP addresses to avoid being tracked. Many sites do not like to allow accesses of users that use the Tor network, as users may use anonymous access perform illegal activities. This class provides a solution that allows to determine if an user is accessing a site using the Tor network. This allows a PHP site to disallow the user to access a site using the Tor network.

Example

<?php
require_once 'src/TorDetect.php';

try {
    $instance = \TorDetect\TorDetect::getInstance();
    
    // check current users ip and
    // return 1 or 0
    print intval($instance->isTorActive());

    // check ip of another user
    print intval($instance->setTarget('1.2.3.4')->isTorActive());
} catch (\Exception $e) {
    print $e->getMessage();
}