Ban Timer
1.1 SP
This YaBB mod will allow you to set temporary bans to a day timer. When a temporarily-banned user visits the forum, he will be displayed a message such as this:
Sorry, you have been banned from using this forum for 7 days.
You have 5 days left until the ban will be lifted.
After installing this mod, you can go to the "Ban Members" section of your YaBB Admin Center and set both temporary and permanent bans like this:
IP NUMBER|NUMBER OF DAYS BANNED
or
EMAIL ADDRESS|NUMBER OF DAYS BANNED
Example:
43.123|7
If you set the number of days banned to 0, the ban will be set as permanent. If you type in the IP address or e-mail address alone, the time banned will automatically be set to 0, a permanent ban.
After you edit the ban list, if you re-enter, you will see a date and time at the end of each line, like this:
43.123|7|12/11/01 at 18:29:39
Do not touch the date/time unless you know what you are doing. If it is erased, the ban timer will be reset.
Note: This will work on a newly-downloaded version of YaBB Gold. There is a slight bug in the security file, reguarding a "chop" command. If you have hacked the file and altered this command to "chomp," please be sure to run this mod on a restored or original version of the YaBB Gold Release Security file ONLY.
RoyalRanger (SP1 Conversion - Omario)
http://nessite.myrmid.com/
Sources\Admin.pl
&is_admin;
my( $l, $ban_user, $ban_time, $ban_date, @lines, @lines_email );
fopen(FILE, ">$vardir/ban.txt", 1);
print FILE "$FORM{'ban'}";
fclose(FILE);
fopen(FILE, ">$vardir/ban_email.txt", 1);
print FILE "$FORM{'ban_email'}";
fclose(FILE);
my @lines = split( /\n/, $FORM{'ban'} );
fopen(FILE, ">$vardir/ban.txt", 1);
foreach my $i (@lines) {
($ban_user, $ban_time, $ban_date) = split(/\|/,$i);
if( $ban_time eq "" ) { $ban_time = 0; }
if( $ban_date eq "" ) { $ban_date = $date; }
print FILE qq~$ban_user|$ban_time|$ban_date\n~;
}
fclose(FILE);
my @lines_email = split( /\n/, $FORM{'ban_email'} );
fopen(FILE, ">$vardir/ban_email.txt", 1);
foreach my $i (@lines_email) {
($ban_user, $ban_time, $ban_date) = split(/\|/,$i);
if( $ban_time eq "" ) { $ban_time = 0; }
if( $ban_date eq "" ) { $ban_date = $date; }
print FILE qq~$ban_user|$ban_time|$ban_date\n~;
}
fclose(FILE);
Sources\Security.pl
# IP BANNING
fopen(BAN, "$vardir/ban.txt" );
@entries = ;
fclose(BAN);
foreach $ban_ip (@entries) {
chomp $ban_ip;
$str_len = length($ban_ip);
$comp_ip = substr($user_ip,0,$str_len);
if ($comp_ip eq $ban_ip) {
fopen(LOG, ">>$vardir/ban_log.txt" );
print LOG "$user_ip\n";
fclose(LOG);
$username = "Guest";
&fatal_error("$txt{'678'}$txt{'430'}!");
exit;
}
}
# EMAIL BANNING
if ($username ne 'Guest') {
fopen(BAN, "$vardir/ban_email.txt" );
@entries = ;
fclose(BAN);
foreach $ban_email (@entries) {
chomp $ban_email;
if (lc $ban_email eq lc $settings[2]) {
fopen(LOG, ">>$vardir/ban_log.txt" );
print LOG "$ban_email ($user_ip)\n";
fclose(LOG);
$username = "Guest";
&fatal_error("$txt{'678'}$txt{'430'}!");
exit;
}
}
# IP BANNING
my( $ban_user, $ban_time, $ban_date, $i, $ban_yes, $ban_total, $ban_left );
$remote_ip = $ENV{'REMOTE_ADDR'};
fopen(BAN, "$vardir/ban.txt" );
@entries = ;
fclose(BAN);
fopen(BAN, ">$vardir/ban.txt", 1);
for( $i = 0; $i < @entries; $i++ ) {
$ban_ip = $entries[$i];
chomp($ban_ip);
($ban_user, $ban_time, $ban_date) = split(/\|/,$ban_ip);
if( $ban_time != 0 ) {
$date1 = $ban_date;
$date2 = $date;
&calcdifference;
if( $result >= $ban_time ) { next; }
}
$str_len = length($ban_user);
$comp_ip = substr($remote_ip,0,$str_len);
if ($comp_ip eq $ban_user) {
fopen(LOG, ">>$vardir/ban_log.txt" );
&lock(LOG);
print LOG "$remote_ip\n";
&unlock(LOG);
fclose(LOG);
$username = "Guest";
$ban_total = $ban_time;
if( $ban_time != 0 ) { $ban_left = $ban_total-$result; }
$ban_yes = 1;
}
print BAN "$ban_ip\n";
}
fclose(BAN);
# EMAIL BANNING
if ($username ne 'Guest') {
$remote_ip = "$ENV{'REMOTE_ADDR'}";
fopen(BAN, "$vardir/ban_email.txt" );
@entries_email = ;
fclose(BAN);
fopen(BAN, ">$vardir/ban_email.txt", 1);
for( $i = 0; $i < @entries_email; $i++ ) {
$ban_email = $entries_email[$i];
chomp($ban_email);
($ban_user, $ban_time, $ban_date) = split(/\|/,$ban_email);
if( $ban_time != 0 ) {
$date1 = $ban_date;
$date2 = $date;
&calcdifference;
if( $result >= $ban_time ) { next; }
}
if (lc $ban_user eq lc $settings[2]) {
fopen(LOG, ">>$vardir/ban_log.txt" );
print LOG "$ban_email ($remote_ip)\n";
fclose(LOG);
$username = "Guest";
$ban_total = $ban_time;
if( $ban_time != 0 ) { $ban_left = $ban_total-$result; }
$ban_yes = 1;
}
print BAN "$ban_email\n";
}
fclose(BAN);
}
if( $ban_yes == 1 ) {
if( $ban_total == 0 ) { &fatal_error("$txt{'678'}$txt{'430'}!"); }
else { &fatal_error("$txt{'678'}$tempban{'1001'} $ban_total $tempban{'1002'} $ban_left $tempban{'1003'}"); }
exit;
}
english.lng
$txt{'749'} = "The 'number of posts' box can only contain digits.";
$tempban{'1'} = ", you have been banned from using this forum for";
$tempban{'2'} = "days.
You have";
$tempban{'3'} = "days left until the ban will be lifted.";
$txt{'724'} = "IP banning: (e.g. 192.168.12.213 or 128.0.*.*) - one entry per line";
$txt{'725'} = "Email banning: (e.g. badguy\@somewhere.com) - one entry per line";
$txt{'724'} = "IP banning: IP NUMBER|NUMBER OF DAYS -- 0 IF PERMANENT
(e.g. 192.168.12.213|7 or 192.168|14) - one entry per line.
You do not have to write the date/time of banning, it will be taken care of. If you do see the date/time of a current banning displayed, do not delete it, else the ban timer will be reset.
";
$txt{'725'} = "Email banning: E-MAIL ADDRESS|NUMBER OF DAYS -- 0 IF PERMANENT
(e.g. badguy\@somewhere.com|0) - one entry per line.
You do not have to write the date/time of banning, it will be taken care of. If you do see the date/time of a current banning displayed, do not delete it, else the ban timer will be reset.
";