rendered paste body//==Disabled inactive users
$days = 60; //==days of inactivity
$dt= time() - ($days * 86400);
$res = mysql_query("SELECT id, modcomment, last_access FROM users WHERE last_access < $dt AND enabled='yes'") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) > 0) {
while ($arr = mysql_fetch_assoc($res)) {
$modcomment = sqlesc(get_date( time(), 'DATE', 1 ) . " - Auto-disabled for inactivity By System\n");
$users_buffer[] = '(' . $arr['id'] . ', \'no\', ' . $modcomment . ')';
}
if (sizeof($users_buffer) > 0) {
@mysql_query("INSERT INTO users (id, enabled, modcomment) VALUES " . implode(', ', $users_buffer) . " ON DUPLICATE key UPDATE enabled=values(enabled),
modcomment=concat(values(modcomment),modcomment)") or sqlerr(__FILE__, __LINE__);
$count = mysql_affected_rows();
write_log("Cleanup: Disabled " . $count . " Member(s) for inactivity");
}
unset ($users_buffer);
}
//==End