2017 © Pedro Peláez
 

library is-tor

Detects whether the current visitor accessing your site from a Tor network exit point

image

mic2100/is-tor

Detects whether the current visitor accessing your site from a Tor network exit point

  • Saturday, June 13, 2015
  • by mic2100
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

IsTor?

Detect whether a visitor is accessing your site from the Tor network., (*1)

Usage

Getting the Tor ip addresses, (*2)

$filename = sys_get_temp_dir() . '/ips.ip';
$storage = new Storage\FileStorage;
$engine = new Engine;
$subscriptions = new Subscriptions($engine, $storage);
$assessor = new Assessor($engine, $storage);

//This needs to be run from within a cron job so that the file is kept up to date
//ip address of the server
$ip = '11.12.13.14';
$subscriptions->addSubscription(new Tor($ip))
              ->setName($filename)
              ->retrieve();

Checking the user, (*3)

$filename = sys_get_temp_dir() . '/ips.ip';
$storage = new Storage\FileStorage;
$engine = new Engine;
$subscriptions = new Subscriptions($engine, $storage);
$assessor = new Assessor($engine, $storage);

//This needs to be ran on each of the requests that are received from users
//Ideally the isTor method responses can be cached in APC (or other caching system)
$ip = $_SERVER['REMOTE_ADDR'];

if ($assessor->setStorageName($filename)->isTor($ip)) {
    //the current visitor is accessing your site through the Tor network
}

//the current visitor is not accessing your site through the Tor network

Bitdeli Badge, (*4)

The Versions

13/06 2015

dev-master

9999999-dev

Detects whether the current visitor accessing your site from a Tor network exit point

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Michael Bardsley

tor tor server detection