zubzizub
7/8/2016 - 1:21 PM

Flood.php

<?php

class Shared_Protection_Flood
{

    //public $session;

    public function accessToAddReviews()
    {
        //$this->session = new Zend_Session_Namespace('floodProtection');

        $data = new B_Cookies_Storage();

        $process = $data->getValue('process');
        $count = $data->getValue('count');

        if ($process) {
            //$this->session->process;
            $count += 1;
            $data->setValue('count', $count, time()+60);
            return false;
        } else {
            //$this->session->setExpirationSeconds(Breathbath_Config::val('protect_time_limit'), 'process');
            //$this->session->setExpirationSeconds(Breathbath_Config::val('protect_time_limit'), 'count');
            //$this->session->process = true;
            $count = 1;
            $data->setValue('count', $count, time()+60);
            $data->setValue('process', true, time()+60);
            return true;
        }
    }
}