Always annoyed me that does not register changes made by staff in a user profile.
So I changed this thing for the more important options and so far it seems that it works properly.
In account-details.php find this code:
So I changed this thing for the more important options and so far it seems that it works properly.
In account-details.php find this code:
begin_frame(T_("STAFF_ONLY_INFO"));
And delete everything starting with this code and ending with the first:
end_frame();
So you must delete the entire frame from the beginning at the end. Instead of this frame copy the following code:
begin_frame(T_("STAFF_ONLY_INFO"));
$avatar = htmlspecialchars($user["avatar"]);
$signature = htmlspecialchars($user["signature"]);
$uploaded = $user["uploaded"];
$downloaded = $user["downloaded"];
$enabled = $user["enabled"] == 'yes';
$warned = $user["warned"] == 'yes';
$forumbanned = $user["forumbanned"] == 'yes';
$username = htmlspecialchars($user[username]);
$modcomment = htmlspecialchars($user["modcomment"]);
$info = htmlspecialchars($user["info"]);
$teams = "<option value='0'>--- ".T_("NONE_SELECTED")." --- </option>\n";
$sashok = SQL_Query_exec("SELECT id,name FROM teams ORDER BY name");
while ($sasha = mysql_fetch_array($sashok))
$teams .= "<option value='$sasha[id]'" . ($user["team"] == $sasha['id'] ? " selected='selected'" : "") . ">$sasha[name]</option>\n";
print("<table width='99%' align='center' border='0' cellspacing='0' cellpadding='5'>\n");
//===| Start Recorded Changes |===//
//change username
if (get_user_class() >= 6) {
print("<form method='post' action='admin-modtasks.php'>\n");
print("<input type='hidden' name='action' value='name' />\n");
print("<input type='hidden' name='userid' value='$id' />\n");
print("<input type='hidden' name='username' value='".$user["username"]."' />\n");
print("<tr><td width='15%'>".T_("USERNAME").": </td><td width='84%' align='left'><input type='text' size='24' name='name' value=\"" . $username . "\">\n");
print("<font style='margin-left:7px'><input type='submit' value='Change Name' /></font>\n");
print("</td></tr>\n");
print("</form>\n");
}
//change email
if (get_user_class() >= 6) {
print("<form method='post' action='admin-modtasks.php'>\n");
print("<input type='hidden' name='action' value='email' />\n");
print("<input type='hidden' name='userid' value='$id' />\n");
print("<input type='hidden' name='username' value='".$user["username"]."' />\n");
print("<input type='hidden' name='oldemail' value=\"$user[email]\" />\n");
print("<tr><td>".T_("EMAIL")."</td><td align='left'><input type='text' size='24' name='email' value=\"$user[email]\" />\n");
print("<font style='margin-left:7px'><input type='submit' value='Change Email' /></font>\n");
print("</td></tr>\n");
print("</form>\n");
}
//change upload
if (get_user_class() >= 6) {
print("<form method='post' action='admin-modtasks.php'>\n");
print("<input type='hidden' name='action' value='uploaded' />\n");
print("<input type='hidden' name='userid' value='$id' />\n");
print("<input type='hidden' name='username' value='".$user["username"]."' />\n");
print("<input type='hidden' name='oldupload' value='".$user["uploaded"]."' />\n");
print("<tr><td>".T_("UPLOADED")."</td><td align='left'><input type='text' size='24' name='uploaded' value=\"".mksize($user["uploaded"], 9)."\" /></font>\n");
print("<font style='margin-left:7px'><input type='submit' value='Change Upload' />\n");
print("</td></tr>\n");
print("</form>\n");
}
//change download
if (get_user_class() >= 6) {
print("<form method='post' action='admin-modtasks.php'>\n");
print("<input type='hidden' name='action' value='downloaded' />\n");
print("<input type='hidden' name='userid' value='$id' />\n");
print("<input type='hidden' name='username' value='".$user["username"]."' />\n");
print("<input type='hidden' name='olddownload' value='".$user["downloaded"]."' />\n");
print("<tr><td>".T_("DOWNLOADED")."</td><td align='left'><input type='text' size='24' name='downloaded' value=\"".mksize($user["downloaded"], 9)."\" /></font>\n");
print("<font style='margin-left:7px'><input type='submit' value='Change Download' />\n");
print("</td></tr>\n");
print("</form>\n");
}
//change team
if (get_user_class() >= 5) {
print("<form method='post' action='admin-modtasks.php'>\n");
print("<input type='hidden' name='action' value='teams' />\n");
print("<input type='hidden' name='userid' value='$id' />\n");
print("<input type='hidden' name='username' value='".$user["username"]."' />\n");
print("<tr><td>".T_("TEAM").": </td><td align='left'><select name='teams'>\n$teams\n</select>");
print("<font style='margin-left:12px'><input type='submit' value='Change Team' /></font>\n");
print("</td></tr>\n");
print("</form>\n");
}
//change user class
if (get_user_class() >= 5) {
print("<form method='post' action='admin-modtasks.php'>\n");
print("<input type='hidden' name='action' value='class' />\n");
print("<input type='hidden' name='userid' value='$id' />\n");
print("<input type='hidden' name='username' value='".$user["username"]."' />\n");
if ($CURUSER["class"] > $user["class"]){
print("<tr><td width='15%'>".T_("USER")." ".T_("CLASS").": </td><td width='84%' align='left'><select name='class'>\n");
$maxclass = $CURUSER["class"];
for ($i = 1; $i < $maxclass; ++$i)
print("<option value='$i' " . ($user["class"] == $i ? " selected='selected'" : "") . ">$prefix" . get_user_class_name($i) . " \n");
print("</select>\n");
}
print("<font style='margin-left:7px'><input type='submit' value='Change Class' /></font>\n");
print("</td></tr>\n");
print("</form>\n");
}
//change invites
if (get_user_class() >= 5) {
print("<form method='post' action='admin-modtasks.php'>\n");
print("<input type='hidden' name='action' value='invites' />\n");
print("<input type='hidden' name='userid' value='$id' />\n");
print("<input type='hidden' name='username' value='".$user["username"]."' />\n");
print("<input type='hidden' name='oldinvites' value='".$user["invites"]."' />\n");
print("<tr><td>".T_("INVITES").": </td><td align='left'><input type='text' size='4' name='invites' value='".$user["invites"]."' />\n");
print("<font style='margin-left:7px'><input type='submit' value='Change Invites ' /></font>\n");
print("</td></tr>\n");
print("</form>\n");
}
//forum banned
if (get_user_class() >= 5) {
print("<form method='post' action='admin-modtasks.php'>\n");
print("<input type='hidden' name='action' value='forumbanned' />\n");
print("<input type='hidden' name='userid' value='$id' />\n");
print("<input type='hidden' name='username' value='".$user["username"]."' />\n");
print("<tr><td>".T_("FORUM_BANNED").": </td><td align='left'><input name='forumbanned' value='yes' type='radio' " . ($forumbanned ? " checked='checked'" : "") . " /> Yes <input name='forumbanned' value='no' type='radio' " . (!$forumbanned ? " checked='checked'" : "") . " /> No\n");
print("<font style='margin-left:7px'><input type='submit' value='Submit' /></font>\n");
print("</td></tr>\n");
print("</form>\n");
}
//disable/enable account
if (get_user_class() >= 5) {
print("<form method='post' action='admin-modtasks.php'>\n");
print("<input type='hidden' name='action' value='enabled' />\n");
print("<input type='hidden' name='userid' value='$id' />\n");
print("<input type='hidden' name='username' value='".$user["username"]."' />\n");
print("<tr><td>Account Enabled: </td><td align='left'><input name='enabled' value='yes' type='radio' " . ($enabled ? " checked='checked'" : "") . " /> <font color='limegreen'>Yes</font> <input name='enabled' value='no' type='radio' " . (!$enabled ? " checked='checked' " : "") . " /> <font color='red'>No</font>\n");
print("<font style='margin-left:9px'><input type='submit' value='Submit' /></font>\n");
print("</td></tr>\n");
print("</form>\n");
}
//change password
if (get_user_class() >= 5) {
print("<form method='post' action='admin-modtasks.php'>\n");
print("<input type='hidden' name='action' value='password' />\n");
print("<input type='hidden' name='userid' value='$id' />\n");
print("<input type='hidden' name='username' value='".$user["username"]."' />\n");
print("<tr><td>New Password: </td><td align='left'><input type='password' size='24' name='password' value=\"\" />\n");
print("<font style='margin-left:9px'><input type='submit' value='".T_("CHANGE_PASS")."' /></font>\n");
print("</td></tr>\n");
print("</form>\n");
}
//====| End Recorded Changes |====//
print("<tr><td height='7'></td></tr>\n");
print("</table>\n");
print("<table class='f-border comment' width='99%' align='center' cellspacing='0' cellpadding='5'>");
print("<form method='post' action='admin-modtasks.php'>\n");
print("<input type='hidden' name='action' value='edituser' />\n");
print("<input type='hidden' name='userid' value='$id' />\n");
print("<input type='hidden' name='username' value='".$user["username"]."' />\n");
print("<tr><td height='7'></td></tr>\n");
if (get_user_class() == 7) {
print("<tr><td>".T_("DONATED_US").": </td><td align='left'><input type='text' size='4' name='donated' value='$user[donated]' /></td></tr>\n");
} else {
print("<tr><td>".T_("DONATED_US").": </td><td align='left'><input type='text' size='4' name='donated' value='$user[donated]' readonly='readonly' /></td></tr>\n");
}
if (get_user_class() == 7) {
print("<tr><td>".T_("IP_ADDRESS").": </td><td align='left'><input type='text' size='14' name='ip' value=\"$user[ip]\" /></td></tr>\n");
} else {
print("<tr><td>".T_("IP_ADDRESS").": </td><td align='left'><input type='text' size='14' name='ip' value=\"$user[ip]\" readonly='readonly' /></td></tr>\n");
}
print("<tr><td style='padding-top:10px' width='15%'>".T_("TITLE").": </td><td style='padding-top:10px' width='84%' align='left'><textarea cols='70' rows='2' name='title'>".htmlspecialchars($user["title"])."</textarea></td></tr>\n");
print("<tr><td>".T_("SIGNATURE").": </td><td align='left'><textarea cols='70' rows='10' name='signature'>".htmlspecialchars($user["signature"])."</textarea></td></tr>\n");
print("<tr><td>".T_("AVATAR_URL").":</td><td align='left'><textarea cols='70' rows='2' name='avatar'>".htmlspecialchars($user["avatar"])."</textarea></td></tr>\n");
if (get_user_class() == 7) {
print("<tr><td>".T_("MOD_COMMENT").": </td><td align='left'><textarea cols='70' rows='15' name='modcomment'>".$modcomment."</textarea></td></tr>\n");
} else {
print("<tr><td>".T_("MOD_COMMENT").": </td><td align='left'><textarea cols='70' rows='15' name='modcomment' readonly='readonly'>".$modcomment."</textarea></tr>\n");
}
print("<tr><td>Special Notes: </td><td align='left'><textarea cols='70' rows='10' name='info'>$info</textarea><div style='margin-top:5px; margin-bottom:5px'><font size='2' color='red'>First time enter your username [<b>".$CURUSER["username"]."</b>] and then write your note!</font></div></td></tr>\n");
if ($user[passkey] == '') {
print("<tr><td>".T_("PASSKEY").": </td><td align='left'><font color='#FF0000'>This user has no passkey.</font></td></tr>\n");
} else {
print("<tr><td valign='top' style='padding-top:10px'>".T_("PASSKEY").": </td><td align='left'><div style='margin-top:5px; margin-bottom:5px'><b>$user[passkey]</b></div><input name='resetpasskey' value='yes' type='checkbox' /> ".T_("RESET_PASSKEY").". <font color='#FF0000'>".T_("RESET_PASSKEY_MSG").".</font></td></tr>\n");
}
print("<tr><td height='10px'></td></tr>"); // 10px space here
print("<tr><td style='padding-bottom:10px' colspan='2' align='center'><input type='submit' value='Submit' /></td></tr>\n");
print("</form>\n");
print("</table>\n");
end_frame();
In admin-modtasks.php you must change the entire code with this one:
<?php
require_once("backend/functions.php");
dbconn(false);
loggedinonly();
if($CURUSER["edit_users"]!="yes")
show_error_msg(T_("ACCESS_DENIED"),T_("YOU_DONT_HAVE_EDIT_USER_PERM"),1);
$action = $_POST["action"];
if (!$action)
show_error_msg(T_("ERROR"), T_("TASK_NOT_FOUND"), 1);
//===| Start Edit User |===//
if ($action == 'edituser'){
$curusername = ($CURUSER['username']);
$curuserid = ($CURUSER['id']);
$username = sqlesc($_POST["username"]);
$userid = $_POST["userid"];
$title = sqlesc($_POST["title"]);
$signature = sqlesc($_POST["signature"]);
$avatar = sqlesc($_POST["avatar"]);
$ip = sqlesc($_POST["ip"]);
$donated = (float) $_POST["donated"];
$modcomment = sqlesc($_POST["modcomment"]);
$info = sqlesc($_POST["info"]);
if (!is_valid_id($userid))
show_error_msg(T_("EDITING_FAILED"), T_("INVALID_USERID"),1);
SQL_Query_exec("UPDATE users SET title=$title, signature=$signature, avatar=$avatar, ip=$ip, donated=$donated, modcomment=$modcomment, info= $info, support=$support, supportfor=$supportfor WHERE id=$userid");
write_log("<a href=account-details.php?id=$curuserid><b>$curusername</b></a> has edited user <a href=account-details.php?id=$userid><b>$username</b></a> details");
if ($_POST['resetpasskey']=='yes'){
SQL_Query_exec("UPDATE users SET passkey='' WHERE id = $userid");
write_log("<a href=account-details.php?id=$curuserid><b>$curusername</b></a> has reseted passkey for user <a href=account-details.php?id=$userid><b>$username</b></a>");
}
header("Location: account-details.php?id=$userid");
die;
}
//====| End Edit User |====//
//===| Start Forum Banned |===//
if ($action == 'forumbanned') {
$curusername = ($CURUSER['username']);
$curuserid = ($CURUSER['id']);
$username = sqlesc($_POST["username"]);
$userid = $_POST["userid"];
$forumbanned = sqlesc($_POST["forumbanned"]);
$modcomment = $row['modcomment'];
If ($_POST["forumbanned"] != 'yes') {
$modcomment2 = gmdate("d-M-Y") . " - $curusername has removed ban on Forum for this user \n";
} else {
$modcomment2 = gmdate("d-M-Y") . " - $curusername has banned on Forum this user \n";
}
$modcomment = $modcomment2 . "" . $modcomment;
$modcom = sqlesc($modcomment);
SQL_Query_exec("UPDATE users SET forumbanned=$forumbanned, modcomment = CONCAT($modcom,modcomment) WHERE id = $userid");
If ($_POST["forumbanned"] != 'yes') {
write_log("<a href=account-details.php?id=$curuserid><b>$curusername</b></a> has removed ban on Forum for user <a href=account-details.php?id=$userid><b>$username</b></a>");
} else {
write_log("<a href=account-details.php?id=$curuserid><b>$curusername</b></a> has banned on Forum user <a href=account-details.php?id=$userid><b>$username</b></a>");
}
header("Location: account-details.php?id=$userid");
die;
}
//====| End Forum Banned |====//
//===| Start Disable/Enable Account |===//
if ($action == 'enabled') {
$curusername = ($CURUSER['username']);
$curuserid = ($CURUSER['id']);
$username = sqlesc($_POST["username"]);
$userid = $_POST["userid"];
$enabled = sqlesc($_POST["enabled"]);
$modcomment = $row['modcomment'];
If ($_POST["enabled"] == 'yes') {
$modcomment2 = gmdate("d-M-Y") . " - $curusername has enabled this account \n";
} else {
$modcomment2 = gmdate("d-M-Y") . " - $curusername has disabled this account \n";
}
$modcomment = $modcomment2 . "" . $modcomment;
$modcom = sqlesc($modcomment);
SQL_Query_exec("UPDATE users SET enabled=$enabled, modcomment = CONCAT($modcom,modcomment) WHERE id = $userid");
If ($_POST["enabled"] == 'yes') {
write_log("<a href=account-details.php?id=$curuserid><b>$curusername</b></a> has enabled user <a href=account-details.php?id=$userid><b>$username</b></a> account");
} else {
write_log("<a href=account-details.php?id=$curuserid><b>$curusername</b></a> has disabled user <a href=account-details.php?id=$userid><b>$username</b></a> account");
}
header("Location: account-details.php?id=$userid");
die;
}
//====| End Disable/Enable Account |====//
//===| Start Change Invites |===//
if ($action == 'invites') {
$curusername = ($CURUSER['username']);
$curuserid = ($CURUSER['id']);
$username = sqlesc($_POST["username"]);
$userid = $_POST["userid"];
$invites = $_POST["invites"];
$oldinvites = $_POST["oldinvites"];
$modcomment = $row['modcomment'];
$modcomment2 = gmdate("d-M-Y") . " - $curusername has changed Invites from $oldinvites to: $invites \n";
$modcomment = $modcomment2 . "" . $modcomment;
$modcom = sqlesc($modcomment);
SQL_Query_exec("UPDATE users SET invites=$invites, modcomment = CONCAT($modcom,modcomment) WHERE id = $userid");
write_log("<a href=account-details.php?id=$curuserid><b>$curusername</b></a> has changed Invites for user <a href=account-details.php?id=$userid><b>$username</b></a> from <b>$oldinvites</b> to: <b>$invites</b>");
header("Location: account-details.php?id=$userid");
die;
}
//====| End Change Invites |====//
//===| Start Change Team |===//
if ($action == 'teams') {
$curusername = ($CURUSER['username']);
$curuserid = ($CURUSER['id']);
$username = sqlesc($_POST["username"]);
$userid = $_POST["userid"];
$teams = (int) $_POST["teams"];
$query = "SELECT * FROM teams WHERE id='$teams'";
$result = SQL_Query_exec($query);
$row = mysql_fetch_array($result);
if ($teams == 0) {
$teamname = ("None selected");
} else {
$teamname = $row['name'];
}
$modcomment = $row['modcomment'];
$modcomment2 = gmdate("d-M-Y") . " - $curusername has changed Team to: $teamname \n";
$modcomment = $modcomment2 . "" . $modcomment;
$modcom = sqlesc($modcomment);
SQL_Query_exec("UPDATE users SET team=$teams, modcomment = CONCAT($modcom,modcomment) WHERE id = $userid");
write_log("<a href=account-details.php?id=$curuserid><b>$curusername</b></a> has changed Team for user <a href=account-details.php?id=$userid><b>$username</b></a> to: <b>$teamname</b>");
header("Location: account-details.php?id=$userid");
die;
}
//====| End Change Team |====//
//===| Start Change User class |===//
if ($action == 'class') {
$curusername = ($CURUSER['username']);
$curuserid = ($CURUSER['id']);
$username = sqlesc($_POST["username"]);
$userid = $_POST["userid"];
$class = (int) $_POST["class"];
$classname = get_user_class_name($class);
$res = SQL_Query_exec("SELECT class FROM users WHERE id=$userid");
$arr = mysql_fetch_row($res);
$uc = $arr[0];
// skip if class is same as current
if ($uc != $class && $class > 0) {
if ($userid == $CURUSER["id"]) {
show_error_msg(T_("EDITING_FAILED"), T_("YOU_CANT_DEMOTE_YOURSELF"),1);
} elseif ($uc >= get_user_class()) {
show_error_msg(T_("EDITING_FAILED"), T_("YOU_CANT_DEMOTE_SOMEONE_SAME_LVL"),1);
} else {
@SQL_Query_exec("UPDATE users SET class=$class WHERE id=$userid");
// Notify user
$prodemoted = ($class > $uc ? "promoted" : "demoted");
$msg = sqlesc("You have been $prodemoted to '" . get_user_class_name($class) . "' by " . $CURUSER["username"] . ".");
$added = sqlesc(get_date_time());
@SQL_Query_exec("INSERT INTO messages (sender, receiver, msg, added) VALUES(0, $userid, $msg, $added)");
}
}
$modcomment = $row['modcomment'];
$modcomment2 = gmdate("d-M-Y") . " - $curusername has changed user class to: $classname \n";
$modcomment = $modcomment2 . "" . $modcomment;
$modcom = sqlesc($modcomment);
SQL_Query_exec("UPDATE users SET modcomment = CONCAT($modcom,modcomment) WHERE id = $userid");
write_log("<a href=account-details.php?id=$curuserid><b>$curusername</b></a> has changed class for user <a href=account-details.php?id=$userid><b>$username</b></a> to <b>$classname</b>");
header("Location: account-details.php?id=$userid");
die;
}
//====| End Change User class |====//
//===| Start Change Password |===//
if ($action == 'password') {
$curusername = ($CURUSER['username']);
$curuserid = ($CURUSER['id']);
$username = sqlesc($_POST["username"]);
$userid = $_POST["userid"];
$password = $_POST["password"];
if ($password == '') {
show_error_msg(T_("ERROR"), "You must enter something for Password!", 1);
} else {
$modcomment = $row['modcomment'];
$modcomment2 = gmdate("d-M-Y") . " - $curusername has changed password \n";
$modcomment = $modcomment2 . "" . $modcomment;
$modcom = sqlesc($modcomment);
$passreq = SQL_Query_exec("SELECT password FROM users WHERE id=$userid");
$passres = mysql_fetch_assoc($passreq);
if($password != $passres['password']){
$password = passhash($password);
SQL_Query_exec("UPDATE users SET password='$password', modcomment = CONCAT($modcom,modcomment) WHERE id=$userid");
write_log("<a href=account-details.php?id=$curuserid><b>$curusername</b></a> has changed password for user: <a href=account-details.php?id=$userid><b>$username</b></a>");
}
header("Location: account-details.php?id=$userid");
die;
}
}
//====| End Change Password |====//
//===| Start Change User name |===//
if ($action == 'name') {
$curusername = ($CURUSER['username']);
$curuserid = ($CURUSER['id']);
$userid = $_POST["userid"];
$newname = sqlesc($_POST["name"]);
$oldname = sqlesc($_POST["username"]);
if ($_POST["name"] == '') {
show_error_msg(T_("ERROR"), "You must enter something for User Name!", 1);
} else {
$modcomment = $row['modcomment'];
$modcomment2 = gmdate("d-M-Y") . " - $curusername has changed user name from $oldname to: $newname \n";
$modcomment = $modcomment2 . "" . $modcomment;
$modcom = sqlesc($modcomment);
SQL_Query_exec("UPDATE users SET username=$newname, modcomment = CONCAT($modcom,modcomment) WHERE id = $userid");
write_log("<a href=account-details.php?id=$curuserid><b>$curusername</b></a> has changed name for user <b>$oldname</b> into: <a href=account-details.php?id=$userid><b>$newname</b></a>");
header("Location: account-details.php?id=$userid");
die;
}
}
//====| End Change User name |====//
//===| Start Change Email |===//
if ($action == 'email') {
$curusername = ($CURUSER['username']);
$curuserid = ($CURUSER['id']);
$username = sqlesc($_POST["username"]);
$userid = $_POST["userid"];
$email = $_POST["email"];
$oldemail = $_POST["oldemail"];
if ($_POST["email"] == '') {
show_error_msg(T_("ERROR"), "You must enter something for Email!", 1);
} else {
if (!validemail($email))
show_error_msg(T_("EDITING_FAILED"), T_("EMAIL_ADDRESS_NOT_VALID"), 1);
$modcomment = $row['modcomment'];
$modcomment2 = gmdate("d-M-Y") . " - $curusername has changed email from $oldemail to: $email \n";
$modcomment = $modcomment2 . "" . $modcomment;
$modcom = sqlesc($modcomment);
SQL_Query_exec("UPDATE users SET email='$email', modcomment = CONCAT($modcom,modcomment) WHERE id = $userid");
write_log("<a href=account-details.php?id=$curuserid><b>$curusername</b></a> has changed email for user <a href=account-details.php?id=$userid><b>$username</b></a> from <b>$oldemail</b> to: <b>$email</b>");
header("Location: account-details.php?id=$userid");
die;
}
}
//====| End Change Email |====//
//===| Start Change Upload |===//
if ($action == 'uploaded') {
$curusername = ($CURUSER['username']);
$curuserid = ($CURUSER['id']);
$username = sqlesc($_POST["username"]);
$userid = $_POST["userid"];
$uploaded = strtobytes($_POST["uploaded"]);
$upload = mksize($uploaded);
$olduploaded = $_POST["oldupload"];
$oldupload = mksize($olduploaded);
$modcomment = $row['modcomment'];
$modcomment2 = gmdate("d-M-Y") . " - $curusername has changed upload from $oldupload to: $upload \n";
$modcomment = $modcomment2 . "" . $modcomment;
$modcom = sqlesc($modcomment);
SQL_Query_exec("UPDATE users SET uploaded='$uploaded', modcomment = CONCAT($modcom,modcomment) WHERE id = $userid");
write_log("<a href=account-details.php?id=$curuserid><b>$curusername</b></a> has changed upload for user <a href=account-details.php?id=$userid><b>$username</b></a> from <b>$oldupload</b> to: <b>$upload</b>");
header("Location: account-details.php?id=$userid");
die;
}
//====| End Change Upload |====//
//===| Start Change Download |===//
if ($action == 'downloaded') {
$curusername = ($CURUSER['username']);
$curuserid = ($CURUSER['id']);
$username = sqlesc($_POST["username"]);
$userid = $_POST["userid"];
$downloaded = strtobytes($_POST["downloaded"]);
$download = mksize($downloaded);
$olddownloaded = $_POST["olddownload"];
$olddownload = mksize($olddownloaded);
$modcomment = $row['modcomment'];
$modcomment2 = gmdate("d-M-Y") . " - $curusername has changed download from $olddownload to: $download \n";
$modcomment = $modcomment2 . "" . $modcomment;
$modcom = sqlesc($modcomment);
SQL_Query_exec("UPDATE users SET downloaded='$downloaded', modcomment = CONCAT($modcom,modcomment) WHERE id = $userid");
write_log("<a href=account-details.php?id=$curuserid><b>$curusername</b></a> has changed download for user <a href=account-details.php?id=$userid><b>$username</b></a> from <b>$olddownload</b> to: <b>$download</b>");
header("Location: account-details.php?id=$userid");
die;
}
//====| End Change Download |====//
//===| Start Warnings |===//
if ($action == 'addwarning') {
$userid = (int)$_POST["userid"];
$username = sqlesc($_POST["username"]);
$reason = mysql_real_escape_string($_POST["reason"]);
$expiry = (int)$_POST["expiry"];
$type = mysql_real_escape_string($_POST["type"]);
if (!is_valid_id($userid))
show_error_msg(T_("EDITING_FAILED"), T_("INVALID_USERID"),1);
if (!$reason || !$expiry || !$type){
show_error_msg(T_("ERROR"), T_("MISSING_FORM_DATA").".", 1);
}
$timenow = get_date_time();
$expiretime = get_date_time(gmtime() + (86400 * $expiry));
$ret = SQL_Query_exec("INSERT INTO warnings (userid, reason, added, expiry, warnedby, type) VALUES ('$userid','$reason','$timenow','$expiretime','".$CURUSER['id']."','$type')");
$ret = SQL_Query_exec("UPDATE users SET warned='yes' WHERE id='$userid'");
$msg = sqlesc("You have been warned by " . $CURUSER["username"] . " - Reason: ".$reason." - Expiry: ".$expiretime."");
$added = sqlesc(get_date_time());
@SQL_Query_exec("INSERT INTO messages (sender, receiver, msg, added) VALUES(0, $userid, $msg, $added)");
write_log("<b>".$CURUSER['username']."</b> has added a warning for user: <a href='account-details.php?id=$userid'><b>$username</b></a>");
header("Location: account-details.php?id=$userid");
die;
}
//====| End Warnings |====//
//===| Start Delete User |===//
if ($action == "deleteaccount") {
if ($CURUSER["delete_users"] != "yes") //only allow admins to delete users
show_error_msg(T_("ERROR"), T_("TASK_ADMIN"),1);
$userid = (int)$_POST["userid"];
$username = sqlesc($_POST["username"]);
$delreason = sqlesc($_POST["delreason"]);
if (!is_valid_id($userid))
show_error_msg(T_("FAILED"), T_("INVALID_USERID"),1);
if ($CURUSER["id"] == $userid)
show_error_msg("Error", "You cannot delete yourself.", 1);
If ($_POST["delreason"] == '') {
show_error_msg(T_("ERROR"), T_("MISSING_FORM_DATA"), 1);
}
deleteaccount($userid);
write_log("<b>".$CURUSER['username']."</b> has deleted account: <b>$username</b>. Reason: $delreason");
show_error_msg(T_("COMPLETED"), T_("USER_DELETE"), 1);
die;
}
//====| End Delete User |====//
?>


