Include Anonymous when enforcing posting rate limit

This commit is contained in:
Retro_Guy 2021-04-17 10:31:01 -07:00
parent 3b21c05889
commit f90fcbded2
2 changed files with 5 additions and 2 deletions

View File

@ -139,6 +139,9 @@ function generate_msgid($identity) {
function check_rate_limit($name,$set=0,$gettime=0) { function check_rate_limit($name,$set=0,$gettime=0) {
global $CONFIG,$spooldir; global $CONFIG,$spooldir;
if(strcasecmp($name, $CONFIG['anonusername']) == 0) {
$name = session_id();
}
$ratefile=$spooldir.'/'.strtolower($name).'-rate.dat'; $ratefile=$spooldir.'/'.strtolower($name).'-rate.dat';
$postqty=0; $postqty=0;
$first=0; $first=0;

View File

@ -220,7 +220,7 @@ if ($type=="post") {
if(($rate_limit !== FALSE) && ($rate_limit > 0)) { if(($rate_limit !== FALSE) && ($rate_limit > 0)) {
$CONFIG['rate_limit'] = $rate_limit; $CONFIG['rate_limit'] = $rate_limit;
} }
if($CONFIG['rate_limit'] == true && strcmp($name, $CONFIG['anonusername'])) { if($CONFIG['rate_limit'] == true) {
$postsremaining = check_rate_limit($name); $postsremaining = check_rate_limit($name);
if($postsremaining < 1) { if($postsremaining < 1) {
$wait = check_rate_limit($name,0,1); $wait = check_rate_limit($name,0,1);
@ -251,7 +251,7 @@ if ($type=="post") {
if(isset($CONFIG['auto_return']) && ($CONFIG['auto_return'] == true)) { if(isset($CONFIG['auto_return']) && ($CONFIG['auto_return'] == true)) {
echo '<meta http-equiv="refresh" content="0;url='.$file_thread.'?group='.urlencode($returngroup[0]).'"'; echo '<meta http-equiv="refresh" content="0;url='.$file_thread.'?group='.urlencode($returngroup[0]).'"';
} }
if($CONFIG['rate_limit'] == true && strcmp($name, $CONFIG['anonusername'])) { if($CONFIG['rate_limit'] == true) {
$postsremaining = check_rate_limit($name,1); $postsremaining = check_rate_limit($name,1);
echo 'You have '.$postsremaining.' posts remaining of '.$CONFIG['rate_limit'].' posts per hour.<br />'; echo 'You have '.$postsremaining.' posts remaining of '.$CONFIG['rate_limit'].' posts per hour.<br />';
if($postsremaining < 1) { if($postsremaining < 1) {