Yii 1.1: limiter

Limiter
2 followers

This extension can set a limiter to user action. 为用户的某种操作设一个一个时间限制。

Documentation

Requirements

  • Yii 1.0 or above

Installation

  • Extract the release file under protected/components
  • Add componet 'limiter' in main.php
  • Create table [code] CREATE TABLE IF NOT EXISTS si_limit ( id int(11) unsigned NOT NULL AUTO_INCREMENT, action varchar(200) NOT NULL, hash varchar(32) NOT NULL, create_time int(10) unsigned NOT NULL, period int(10) unsigned NOT NULL, total_times smallint(5) unsigned NOT NULL, remain_times smallint(5) unsigned NOT NULL, PRIMARY KEY (id), UNIQUE KEY hash (hash) ) ; [/code]

Usage

See the following code example: ~~~ [code] Yii::app()->Limiter->check(actionName, $params, $period, $total_times); [/code]

[php] Yii::app()->Limiter->spend('actionName', $params); [/php]

Change Log

March 3, 2010

  • Initial release.

Be the first person to leave a comment

Please to leave your comment.

Create extension
  • Yii Version: 1.1
  • License: New BSD License
  • Developed by: dongbeta
  • Category: Others
  • Votes: +1
  • Downloaded: 542 times
  • Created on: Mar 3, 2010
  • Last updated: Mar 3, 2010