Hmm... not sure why that invalid entries thing wasn't working. It was just to make sure the user entered an integer in both fields. Oh well, I just changed it up a little, but not it does a little bit different function
Code:
if ($action=="joindates") {
echo "<p>Remove by length of membership</p>\n";
echo doformheader("thread","doremovejoindate");
echo "<table border=0>";
echo makeinputcode("Delete accounts older than x days:","joindateremove","");
echo makeinputcode("Number of Posts:","joinpostsremove","");
echo doformfooter("Submit");
exit;
} #end joindates
if ($action=="doremovejoindate") {
echo "<p>Deleting...</p>";
if (!$joinpostsremove and !$joindateremove) {
echo "You didn't fill in a required field.";
exit;
//Another note since I'm thinking about it: this might not work either. I'm not sure if a "0" returns as false - try it.
}
$datecut=time()+($joindateremove*86400);
if($cuts=$DB_site->query("SELECT username,userid FROM user WHERE (joindate<=$datecut AND posts<=$joinpostsremove)")) {
while($user=$DB_site->fetch_array($cuts)) {
$DB_site->query("DELETE FROM user WHERE userid=$user[userid]");
echo "$user[username] deleted...<BR>";
}
echo "<p>Accounts removed successfully! It is recommend that you <a href=\"misc.php\">update counters</a> now.</p>";
} else {
echo "<p>No Members match this criteria. Click <a href=\"index.php\">here</a> to return to the admin index page.</p>";
}
} #end doremovejoindate
About 86,400: that's correct. The users registration date/time is stored as a unix timestamp, or seconds since Jan 1, 1970 (?). Since there are 86,400 seconds in a day, 365*86,400 would equal one year in seconds.