]> git.mxchange.org Git - friendica.git/commitdiff
implement max daily registrations
authorfriendica <info@friendica.com>
Wed, 21 Dec 2011 04:12:29 +0000 (20:12 -0800)
committerfriendica <info@friendica.com>
Wed, 21 Dec 2011 04:12:29 +0000 (20:12 -0800)
mod/register.php

index 0115ec0d58e12ddac23fa42382ba1c4563ba588c..89f561642af36a329c8908372fafafaec72d163c 100644 (file)
@@ -8,6 +8,15 @@ function register_post(&$a) {
        $verified = 0;
        $blocked  = 1;
 
+
+       $max_dailies = intval(get_config('system','max_daily_registrations'));
+       if($max_dailes) {
+               $r = q("select count(*) as total from user where register_date > UTC_TIMESTAMP - INTERVAL 1 day");
+               if($r && $r[0]['total'] >= $max_dailies) {
+                       return;
+               }
+       }
+
        switch($a->config['register_policy']) {
 
        
@@ -462,6 +471,16 @@ function register_content(&$a) {
                return;
        }
 
+       $max_dailies = intval(get_config('system','max_daily_registrations'));
+       if($max_dailes) {
+               $r = q("select count(*) as total from user where register_date > UTC_TIMESTAMP - INTERVAL 1 day");
+               if($r && $r[0]['total'] >= $max_dailies) {
+                       logger('max daily registrations exceeded.');
+                       notice( t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.') . EOL);
+                       return;
+               }
+       }
+
        if(x($_SESSION,'theme'))
                unset($_SESSION['theme']);