From d9ede7f7bd1f2a1ab1bacaf4a37a66fd79fd32e4 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 20 Dec 2011 20:12:29 -0800 Subject: [PATCH] implement max daily registrations --- mod/register.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/mod/register.php b/mod/register.php index 0115ec0d58..89f561642a 100644 --- a/mod/register.php +++ b/mod/register.php @@ -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']);