User Delete/Ban on "bad" post

This forum is now closed as part of retiring phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
ImpactDNI
Registered User
Posts: 36
Joined: Sat May 01, 2004 5:54 pm

User Delete/Ban on "bad" post

Post by ImpactDNI »

Was about to start coding this, but was wondering what the best way to go about it is...

I would like to have a mod, that is 'config'able through the admin panel. You would be able to set a postcount and an array of words.

When a user goes to post a new topic, it would check these 2 fields. If this users postcount < the set post count, and the title contains a word from the list, then the user would be banned/deleted.

The reason for this is, I have had an influx of users using a bot of sorts to reg an account (even with the email auth, and the image verification turned on), and their first posts always contain "Free". So, by banning themselves (or deleting the account) on a bad post (and even giving them the reason it was deleted), it would severly cut down on the amount of bad first posts.

What is the best way to go about deleting the account safely if the conditions are met? There seems to be no easy way for me to think of...
MrDeathLlama
Registered User
Posts: 57
Joined: Tue Apr 05, 2005 1:58 am

Post by MrDeathLlama »

I think you would have to first set up a database table which contains the selected words you want to have detected when a user posts and you want them to be banned.
Then, you would probably have something like this.

Code: Select all

$sql     = 'SELECT banned_words FROM phpbb_badwords' 
$result = $db->sql_fetchrows($sql)
if ( $user_posts <= 2 )
   {
    if ( strpos($_POST['postarea'], $result) )
       {
        ban($user_who_posted); // I just made up this function.
       }
    }
       else
           {
      // let user post!
           }
Meh. You'll have something like that when checking for the bad words.
ImpactDNI
Registered User
Posts: 36
Joined: Sat May 01, 2004 5:54 pm

Post by ImpactDNI »

yeah, my problem was the coding of the ban function =P
any ideas on how to go about that?
MrDeathLlama
Registered User
Posts: 57
Joined: Tue Apr 05, 2005 1:58 am

Post by MrDeathLlama »

See the table phpbb_banlist? I think that is how you will ban them. I think phpbb uses id s to ban users by username, so you should get the userid of the person who posted the bad word and have something like this.

Code: Select all

$user_id = user who posted 
DEFINE("USER_ID", "$user_id")
$sql = "INSERT INTO phpbb_banlist (ban_id,ban_userid) VALUES(' ', 'USER_ID');
$result = $db->sql_query($sql)
ban_id and ban_userid are both integers, and since ban_id autoincrements, you can leave the value for it empty.
ImpactDNI
Registered User
Posts: 36
Joined: Sat May 01, 2004 5:54 pm

Post by ImpactDNI »

well, I guess that is the easy way =P
I'll hack this together in the next few days (really busy)
Would anyone be interested in me publishing it?
or is it too small?
MrDeathLlama
Registered User
Posts: 57
Joined: Tue Apr 05, 2005 1:58 am

Post by MrDeathLlama »

You can go ahead and send it to the mod database. Even small mods are accepted into the it.
Post Reply

Return to “[2.0.x] MOD Requests”