[RC] Temp Ban 1.0.1

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
szquirrel
Registered User
Posts: 21
Joined: Wed Mar 24, 2004 1:07 am

[RC] Temp Ban 1.0.1

Post by szquirrel » Wed Mar 08, 2006 4:03 am

MOD Title: Temp Ban
MOD Description: This MOD adds the option of temporary user, ip, and email bans.
MOD Version: 1.0.1

MOD Download: http://www.digitalsquirrel.com/phpbb/tempban_101.zip

When banning a user, ip, or email from the admin pages, this MOD adds an extra field for automatically removing the ban after a number of minutes, hours, days or weeks. Bans that have expired will be automatically removed from the ban table with no further admin action required.

Image

Setting the ban remove field to zero results in a permanent ban. The default database value for this field is zero. Therefore other MODs that touch the ban table but don't know about this MOD will still cause permanent bans as expected. Also all pre-existing bans will still be permanent after this MOD is installed.

I installed this MOD by hand and everything seems to work. I have not tried to install using EasyMOD. Also I don't have my own server so I can't play with the times to easily test hour/day/week bans. I appreciate any and all comments and help with testing.

Version 0.9.1 adds several fixes and now shows the ban expiration date in the unban list.

If you already installed version 0.9.0, I apologize. I made several changes in 0.9.1 and didn't keep track of them all. The basic structure is the same so you should be able to compare the two and figure it out.

Version 1.0.0 RC1 fixes bugs in the MOD template but the actual code is identical. If you already installed 0.9.1 you can ignore 1.0.0 RC1.

Version 1.0.1 is expected to be the last version of TempBan. This version fixes a bug in the MOD script that was preventing install with EasyMOD. Also the license has been changed from the GPL2 to the less restrictive Creative Commons Attribution 2.5. TempBan will not be resubmitted to the MOD database but will be superceded by BanMaster (see my post later in this thread).
Last edited by szquirrel on Thu Mar 16, 2006 2:28 pm, edited 4 times in total.
Professional squirrel. Closed course. Do not attempt.

szquirrel
Registered User
Posts: 21
Joined: Wed Mar 24, 2004 1:07 am

Post by szquirrel » Wed Mar 08, 2006 2:20 pm

I like where niekas is going with his Instant Ban MOD but I'm not crazy about the idea of lots of old IP bans cluttering up my database. To get similar functionality with Temp Ban, add the following lines:

Code: Select all

# 
#-----[ OPEN ]------------------------------------------ 
#
templates/subSilver/profile_add_body.tpl


# 
#-----[ FIND ]------------------------------------------ 
#
	<!-- END switch_confirm -->


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	<!-- BEGIN switch_edit_profile -->


# 
#-----[ FIND ]------------------------------------------ 
#
		<textarea name="signature" style="width: 300px" rows="6" cols="30" class="post">{SIGNATURE}</textarea>
	  </td>
	</tr>


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	<!-- END switch_edit_profile -->


# 
#-----[ OPEN ]------------------------------------------ 
#
includes/usercp_register.php


# 
#-----[ FIND ]------------------------------------------ 
#
$error = FALSE;


# 
#-----[ BEFORE, ADD ]------------------------------------------ 
#

if ( $mode == 'register' && ( isset($HTTP_POST_VARS['icq']) || isset($HTTP_POST_VARS['aim']) || isset($HTTP_POST_VARS['msn']) || isset($HTTP_POST_VARS['yim']) || isset($HTTP_POST_VARS['website']) || isset($HTTP_POST_VARS['location']) || isset($HTTP_POST_VARS['occupation']) || isset($HTTP_POST_VARS['interests']) || isset($HTTP_POST_VARS['signature']) ) )
{
	$ban_until = time() + (60 * 60 * 24 * 7);  // ban for one week

	$sql = "INSERT INTO " . BANLIST_TABLE . " (ban_ip,ban_until)
	VALUES ('" . $user_ip . ',' . $ban_until . "')";
	if ( !$db->sql_query($sql) )
	{
		message_die(GENERAL_ERROR, "Couldn't insert ban info into database", "", __LINE__, __FILE__, $sql);
	}
	$sql = "DELETE FROM " . SESSIONS_TABLE . "
		WHERE session_ip = '" . $user_ip . "'";
	if ( !$db->sql_query($sql) )
	{
		message_die(GENERAL_ERROR, "Couldn't delete banned sessions from database", "", __LINE__, __FILE__, $sql);
	}
	message_die(CRITICAL_MESSAGE, 'You_been_banned');
}
I'm not sure what to do with this snippet. I don't think it belongs in the Temp Ban MOD proper but it doesn't really stand on its own.
Last edited by szquirrel on Thu Mar 09, 2006 3:17 pm, edited 1 time in total.
Professional squirrel. Closed course. Do not attempt.

User avatar
apfan
Registered User
Posts: 168
Joined: Thu Jun 02, 2005 4:15 am
Location: PhpBB 2.22.x For president!

Post by apfan » Wed Mar 08, 2006 3:15 pm

Very good MOD ill hope you finish it soon :)

User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw » Wed Mar 08, 2006 3:33 pm

This is great, i'll install it, if it gets validated :)

rockboyteek
Registered User
Posts: 591
Joined: Tue Mar 29, 2005 2:50 pm
Contact:

Post by rockboyteek » Wed Mar 08, 2006 5:10 pm

there is already a mod like this called bantron :D
http://www.adminfuel.com/ - Forum for Forum Administrators

User avatar
bonelifer
Community Team Member
Community Team Member
Posts: 3466
Joined: Wed Oct 27, 2004 11:35 pm
Name: William
Contact:

Post by bonelifer » Wed Mar 08, 2006 5:36 pm

Bantron has many bugs. For which the fixes are scattered among several websites.
Knowledge Base | phpBB Board Rules | Search Customisation Database
Image
Please don't contact me via PM or email for phpBB support .

rockboyteek
Registered User
Posts: 591
Joined: Tue Mar 29, 2005 2:50 pm
Contact:

Post by rockboyteek » Wed Mar 08, 2006 5:39 pm

o damn it does?.. i have been using it.. any secure/stable mod like it.. where are the bug fixes?
http://www.adminfuel.com/ - Forum for Forum Administrators

szquirrel
Registered User
Posts: 21
Joined: Wed Mar 24, 2004 1:07 am

Post by szquirrel » Wed Mar 08, 2006 6:30 pm

Blargh, found a bug. The section of the MOD that looks like this:

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
#
				VALUES ('" . str_replace("\'", "''", $email_list[$i]) . "')";


#
#-----[ IN LINE FIND ]------------------------------------------
# 
$email_list[$i])


#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
# 
 . "," . $email_ban_until
Should be changed to this:

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
#
				VALUES ('" . str_replace("\'", "''", $email_list[$i]) . "')";


#
#-----[ IN LINE FIND ]------------------------------------------
# 
$email_list[$i]) ."'


#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
# 
" . "," . $email_ban_until . "
Professional squirrel. Closed course. Do not attempt.

Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 25196
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Post by Paul » Wed Mar 08, 2006 6:56 pm

rockboyteek wrote: there is already a mod like this called bantron :D
bonelifer wrote: Bantron has many bugs. For which the fixes are scattered among several websites.

And extended ban manager/ban suite. has the same as this, and more :)
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

szquirrel
Registered User
Posts: 21
Joined: Wed Mar 24, 2004 1:07 am

Post by szquirrel » Wed Mar 08, 2006 8:08 pm

I looked at Bantron and EBM but decided that neither was the solution I was looking for. That's why I wrote Temp Ban.
Professional squirrel. Closed course. Do not attempt.

Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 25196
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Post by Paul » Wed Mar 08, 2006 9:14 pm

You mean that ebm has more then you needed?
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

szquirrel
Registered User
Posts: 21
Joined: Wed Mar 24, 2004 1:07 am

Post by szquirrel » Wed Mar 08, 2006 9:47 pm

paul999 wrote: You mean that ebm has more then you needed?

More than I needed, and some things I would have chosen to do differently.

...Updated to version 0.9.1
Professional squirrel. Closed course. Do not attempt.

szquirrel
Registered User
Posts: 21
Joined: Wed Mar 24, 2004 1:07 am

Post by szquirrel » Thu Mar 09, 2006 3:33 pm

So, I have some other ideas that build off of Temp Ban. I already posted my take on automatic spambot banning and I'm also playing with a way for admins to grant their moderators a limited temp ban ability.

My question is, how do I package these? Temp Ban stands by itself and I don't want to feature creep it, but these other MODs don't work as stand-alones. Is there a way for a MOD author to offer this kind of fine control over features?
Professional squirrel. Closed course. Do not attempt.

rockboyteek
Registered User
Posts: 591
Joined: Tue Mar 29, 2005 2:50 pm
Contact:

Post by rockboyteek » Thu Mar 09, 2006 4:39 pm

do you mean the feature?... just put them in a file with the Temp Ban download as Extra Features :D
http://www.adminfuel.com/ - Forum for Forum Administrators

MaddoxX
Registered User
Posts: 450
Joined: Sat May 15, 2004 4:43 pm
Location: Russia

Post by MaddoxX » Thu Mar 09, 2006 5:28 pm

Just wondering.. would this be compatible with bantron next to it :P
:D

Locked

Return to “[2.0.x] MODs in Development”