Top Hosting Forum

WebHosting Reviews Forum


How to setup Cronjob to delete inactive SPAM users

PHPBB forum script Discussion. PHPBB Questions, Troubleshooting, Errors, Mods and so on..
Hosting Forum Description
PHPBB forum script Discussion. PHPBB Questions, Troubleshooting, Errors, Mods and so on..

How to setup Cronjob to delete inactive SPAM users

Postby hostingforum » Tue Dec 11, 2012 8:13 pm

Hi, i have found on my PHPBB forum , suddenly there are 5000 users where before a few days was 500 so i looked on the members list and found many users with zero posts.

What to do? How to remove inactive/spam users?

1) You can prune (clean) them from PHP adminsitration manually. In administration Go to "Users & Groups" tab. Click "Prune Users".
Into "Last active:" field enter "0000-00-00". This will delete all users who registered an account but never loged in.

2) You can create php script with MYSQL search & delete command and setup cronjob to run this script regularly.
Script content might be: (but please backup your forum mysql first so you dont loose any important data) I dont guarantee these scripts are up to date and working.

<?php
// cron job to delete inactive users older than 48 hours
$db=mysql_connect('server','user','password');
mysql_select_db('your_phpbb_database_here',$db);
$strSQL="DELETE phpbb_users u, phpbb_user_group ug, " .
"phpbb_groups AS g FROM phpbb_users u, " .
"phpbb_user_group ug, phpbb_groups g WHERE " .
"u.user_active=0 AND u.user_id>0 AND " .
"u.user_id=ug.user_id AND ug.group_id=g.group_id " .
"AND g.group_single_user=1 AND " .
"FROM_UNIXTIME(u.user_regdate)<" .
"DATE_SUB(NOW(),INTERVAL 2 DAY);";
mysql_query($strSQL,$db) or die(mysql_error());
mysql_close($db);
?>


or

DELETE phpbb_users u, phpbb_user_group ug, phpbb_groups AS g FROM phpbb_users u, phpbb_user_group ug, phpbb_groups g WHERE u.user_active=0 AND u.user_id&gt;0 AND u.user_id = ug.user_id AND ug.group_id = g.group_id AND g.group_single_user = 1 AND FROM_UNIXTIME(u.user_regdate)&lt;DATE_SUB(NOW(),INTERVAL 2 DAY);


3) Install ADAP (Advanced Double Activation Pack PHPBB Mod) it has feature to auto prune junk not activated PHPBB users
https://www.phpbb.com/customise/db/mod/advanced_double_activation_pack/



Ad: There You can have your forum site-wide banner/text ad for $19 monthly. Contact admin


User avatar
hostingforum
Site Admin
 
Posts: 647
Joined: Fri May 20, 2011 7:58 pm
Location: Czech Republic

Return to PHPBB

Who is online

Users browsing this forum: No registered users and 0 guests

.

cron