(BanID.php)
 
(No difference)

Latest revision as of 12:39, 10 July 2016

Concept

Latest releases of BrandMaster has some logic to temporary ban Private IDs. Real-time logic placed at Script/Modules/Filter.lua

The idea is very simple: Memcached has functionality for timed storage. We need to put any value to cache with following syntax:

Ban-<private ID>

BanPrivateID.php

<syntaxhighlight lang="php"> <?php

 unset($number);
 unset($interval);
 if (isset($_SERVER) &&
     array_key_exists("number", $_GET) &&
     array_key_exists("interval", $_GET))
 {
   $number = intval($_GET["number"]);
   $interval = intval($_GET["interval"]);
 }
 if ((php_sapi_name() == "cli") &&
     ($argc >= 3))
 {
   $number = intval($argv[1]);
   $interval = intval($argv[2]);
 }
 if (isset($number))
 {
   $cache = new Memcache();
   $cache->connect("localhost", 11211);
   $cache->set("Ban-$number", 1, 0, $interval);
 }

?> </syntaxhighlight>

Concept[edit]

Latest releases of BrandMaster has some logic to temporary ban Private IDs. Real-time logic placed at Script/Modules/Filter.lua

The idea is very simple: Memcached has functionality for timed storage. We need to put any value to cache with following syntax:

Ban-<private ID>

BanPrivateID.php[edit]

<syntaxhighlight lang="php"> <?php

 unset($number);
 unset($interval);
 if (isset($_SERVER) &&
     array_key_exists("number", $_GET) &&
     array_key_exists("interval", $_GET))
 {
   $number = intval($_GET["number"]);
   $interval = intval($_GET["interval"]);
 }
 if ((php_sapi_name() == "cli") &&
     ($argc >= 3))
 {
   $number = intval($argv[1]);
   $interval = intval($argv[2]);
 }
 if (isset($number))
 {
   $cache = new Memcache();
   $cache->connect("localhost", 11211);
   $cache->set("Ban-$number", 1, 0, $interval);
 }

?> </syntaxhighlight>