echo makeinputcode("User Name contains","ausername");
if ($pwdincp!=0) {
echo makeinputcode("and password contains","apassword");
}
echo makechoosercode("and usergroup is","usergroupid","usergroup",-1,"Any");
echo makeinputcode("and email contains","aemail");
echo makeinputcode("and parent's email contains","parentemail");
echo makeinputcode("and is coppa user (yes, no, blank for don't mind)","coppauser");
echo makeinputcode("and homepage contains","homepage");
echo makeinputcode("and ICQ Number contains","icq");
echo makeinputcode("and AIM Handle contains","aim");
echo makeinputcode("and Yahoo Messenger Handle contains","yahoo");
echo makeinputcode("and Biography contains","biography");
echo makeinputcode("and Signature contains","signature");
echo makeinputcode("and User Title contains","usertitle");
echo makeinputcode("and Join Date is after<br>(Format yyyy-mm-dd, leave blank for today)","joindateafter");
echo makeinputcode("and Join Date is before<br>(Format yyyy-mm-dd, leave blank for today)","joindatebefore");
echo makeinputcode("and Last Visit is after<br>(Format yyyy-mm-dd hh:mm:ss, leave blank for today)","lastvisitafter");
echo makeinputcode("and Last Visit is before<br>(Format yyyy-mm-dd hh:mm:ss, leave blank for today)","lastvisitbefore");
echo makeinputcode("and Last Post is after<br>(Format yyyy-mm-dd hh:mm:ss, leave blank for today)","lastpostafter");
echo makeinputcode("and Last Post is before<br>(Format yyyy-mm-dd hh:mm:ss, leave blank for today)","lastpostbefore");
echo makeinputcode("and Number of Posts is greater than","postslower");
echo makeinputcode("and Number of Posts is less than","postsupper");
echo doformfooter();
}
// ###################### Start domove by Xenon ##############
if ($action=="domove") {
if (isset($perpage)==0 or $perpage=="") {
$perpage=1000;
}
if (isset($startat)==0 or $startat=="") {
$startat=0;
}
$finishat=$startat+$perpage;
echo "<p>User ids:</p>";
if ($condition=="") {
$condition="1=1";
if ($ausername!="") {
$condition.=" AND INSTR(username,'".addslashes($ausername)."')>0";
}
if ($apassword!="") {
$condition.=" AND INSTR(password,'".addslashes($apassword)."')>0";
}
if ($usergroupid!=-1 and $usergroupid!="") {
$condition.=" AND usergroupid=$usergroupid";
}
if ($aemail!="") {
$condition.=" AND INSTR(email,'".addslashes($aemail)."')>0";
}
if ($parentemail!="") {
$condition.=" AND INSTR(parentemail,'".addslashes($parentemail)."')>0";
}
$coppauser=strtolower($coppauser);
if ($coppauser=="yes") {
$condition.=" AND coppauser=1";
}
if ($coppauser=="no") {
$condition.=" AND coppauser=0";
}
if ($homepage!="") {
$condition.=" AND INSTR(homepage,'".addslashes($homepage)."')>0";
}
if ($icq!="") {
$condition.=" AND INSTR(icq,'".addslashes($icq)."')>0";
}
if ($aim!="") {
$condition.=" AND INSTR(aim,'".addslashes($aim)."')>0";
}
if ($yahoo!="") {
$condition.=" AND INSTR(yahoo,'".addslashes($yahoo)."')>0";
}
if ($biography!="") {
$condition.=" AND INSTR(biography,'".addslashes($biography)."')>0";
}
if ($signature!="") {
$condition.=" AND INSTR(signature,'".addslashes($signature)."')>0";
}
if ($usertitle!="") {
$condition.=" AND INSTR(usertitle,'".addslashes($usertitle)."')>0";
}
if ($joindateafter!="") {
$condition.=" AND joindate>UNIX_TIMESTAMP('".addslashes($joindateafter)."')";
}
if ($joindatebefore!="") {
$condition.=" AND joindate<UNIX_TIMESTAMP('".addslashes($joindatebefore)."')";
}
if ($lastvisitafter!="") {
$condition.=" AND lastvisit>UNIX_TIMESTAMP('".addslashes($lastvisitafter)."')";
}
if ($lastvisitbefore!="") {
$condition.=" AND lastvisit<UNIX_TIMESTAMP('".addslashes($lastvisitbefore)."')";
}
if ($lastpostafter!="") {
$condition.=" AND lastpost>UNIX_TIMESTAMP('".addslashes($lastpostafter)."')";
}
if ($lastpostbefore!="") {
$condition.=" AND lastpost<UNIX_TIMESTAMP('".addslashes($lastpostbefore)."')";
}
if ($postslower!="") {
$condition.=" AND posts>$postslower";
}
if ($postsupper!="") {
$condition.=" AND posts<$postsupper";
}
}
$users=$DB_site->query("SELECT userid,usertitle,usergroupid,customtitle,posts FROM user WHERE $condition AND userid>=$startat AND userid<$finishat ORDER BY userid DESC");
while ($user=$DB_site->fetch_array($users)) {
$userid=$user[userid];
// check that not removing last admin
$countadmin=$DB_site->query_first("SELECT COUNT(userid) AS users FROM user,usergroup WHERE user.usergroupid=usergroup.usergroupid AND usergroup.cancontrolpanel=1 AND user.userid<>$userid");
$getperms=$DB_site->query_first("SELECT cancontrolpanel FROM usergroup WHERE usergroupid=$usergroupid");
if ($countadmin[users]==0 and $getperms[cancontrolpanel]!=1) {
echo "<p>You are about to edit the last user with control panel access so that they do not have control panel access. This would lock you out of the control panel, so you cannot proceed.</p></body></html>";
exit;
}
// Change Group
$DB_site->query("UPDATE user SET usergroupid=$newusergroupid WHERE userid=$userid");
// Update Titles
if ($updatetitle==1) {
if ($user[customtitle]==0) {
$usergroup=$DB_site->query_first("SELECT usertitle FROM usergroup WHERE usergroupid=$newusergroupid");
if ($usergroup[usertitle]=="") {
$gettitle=$DB_site->query_first("SELECT title FROM usertitle WHERE minposts<=$user[posts] ORDER BY minposts DESC LIMIT 1");
$usertitle=$gettitle[title];
} else {
$usertitle=$usergroup[usertitle];
}
$sql="usertitle='".addslashes($usertitle)."'";
$DB_site->query("UPDATE user SET $sql WHERE userid=$userid");
}
}
echo "$user[userid]<br>\n";
flush();
}
if ($checkmore=$DB_site->query_first("SELECT userid FROM user WHERE $condition AND userid>=$finishat")) {