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(idint(11) unsigned NOT NULL AUTO_INCREMENT,actionvarchar(200) NOT NULL,hashvarchar(32) NOT NULL,create_timeint(10) unsigned NOT NULL,periodint(10) unsigned NOT NULL,total_timessmallint(5) unsigned NOT NULL,remain_timessmallint(5) unsigned NOT NULL, PRIMARY KEY (id), UNIQUE KEYhash(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.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.