/** * @return boolean Return "true" If we believe that this person takes too much request otherwise "false" */ public function cookie() { $oCookie = new Cookie(); if (!$oCookie->exists(static::COOKIE_NAME)) { $oCookie->set(static::COOKIE_NAME, 1, 60 * 60 * 48); } else { $oCookie->set(static::COOKIE_NAME, $oCookie->get(static::COOKIE_NAME) + 1); } if ($oCookie->get(static::COOKIE_NAME) > PH7_DDOS_MAX_COOKIE_PAGE_LOAD) { $oCookie->remove(static::COOKIE_NAME); // Remove Cookie $bStatus = true; } else { $bStatus = false; } unset($oCookie); return $bStatus; }
public function __construct() { $this->_oConfig = Config::getInstance(); $oCookie = new Cookie(); // Check a template name has been entered and if it exceeds the maximum length (49 characters). if (!empty($_REQUEST['tpl']) && strlen($_REQUEST['tpl']) < 50) { $this->_sUserTpl = $_REQUEST['tpl']; $oCookie->set('site_tpl', $this->_sUserTpl, 60 * 60 * 48); } else { if ($oCookie->exists('site_tpl')) { $this->_sUserTpl = $oCookie->get('site_tpl'); } } unset($oCookie); }
public function __construct() { $this->_oConfig = Config::getInstance(); $oCookie = new Cookie(); // Check a template name has been entered and if it meets the required length. if (!empty($_REQUEST['l']) && strlen($_REQUEST['l']) == 5) { $this->_sUserLang = $_REQUEST['l']; $oCookie->set(static::COOKIE_NAME, $this->_sUserLang, 60 * 60 * 48); } else { if ($oCookie->exists(static::COOKIE_NAME)) { $this->_sUserLang = $oCookie->get(static::COOKIE_NAME); } else { $this->_sUserLang = (new \PH7\Framework\Navigation\Browser())->getLanguage(); } } unset($oCookie); }