Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* config/limiter.php */
- // Limiter (redis-based) config
- // [max => X, in => Y] - max X actions in Y seconds for $namespace
- // [global => true, max => X, in => Y] - max X actions in Y seconds global on server
- // ban arg - if exists, ban for this number of seconds after limit reached.
- // Otherwise, disallow action only if it exceeds the limit.
- // Ban applies if max val reached, not max exceeded, but that time action is allowed.
- // SMS limits namespace
- $config['limiter_sms'] = [
- ['max' => 1, 'in' => 60],
- ['global' => true, 'max' => 50, 'in' => 100, 'ban' => 600]
- ];
- // Email limits namespace
- $config['limiter_email'] = [
- ['max' => 3, 'in' => 60],
- ['max' => 20, 'in' => 300, 'ban' => 300],
- ['global' => true, 'max' => 50, 'in' => 100, 'ban' => 600]
- ];
- /* class Anything extends LK_Controller */
- if (($r = $this->limit('sms')) !== true) return ['waitSeconds' => $r];
Advertisement
Add Comment
Please, Sign In to add comment