$del = SQL_Query_exec("SELECT * FROM subs WHERE $query");
while ($arr3 = mysql_fetch_assoc($del))
{
$delsub = $_GET["delsub"];
if (is_valid_id($delsub))
{
show_error_msg("Delete Subtitle","<br /><font size=2>Are you sure you want to delete this subtitle?</font>
<div style=margin-top:5px align=center><font color=#0080FF>".htmlspecialchars($arr3["title"])."</font></div>
<div style='margin-top:10px' align=center><a href=?delete=$arr3[id]>Yes</a> | <a href=subtitles.php>No</a></div>", 1);
}
}
With this one:
$delsub = $_GET["delsub"];
$del = SQL_Query_exec("SELECT * FROM subs WHERE id ='$delsub' AND $query");
while ($arr3 = mysql_fetch_assoc($del))
{
if (is_valid_id($delsub))
{
show_error_msg("Delete Subtitle","<br /><font size=2>Are you sure you want to delete this subtitle?</font>
<div style=margin-top:5px align=center><font size=2 color=#0080FF>".htmlspecialchars($arr3["title"])."</font></div>
<div style='margin-top:10px' align=center><a href=?delete=$delsub>Yes</a> | <a href=subtitles.php>No</a></div>", 1);
}
}

# Remove ban on forum
$res32 = SQL_Query_exec("SELECT id FROM users WHERE forumbanned='yes' AND forumbanneduntil < NOW() AND forumbanneduntil <> '0000-00-00 00:00:00'");
if (mysql_num_rows($res32) > 0)
{
$dt = sqlesc(get_date_time());
$msg = sqlesc("Your ban on forum has been removed.n");
while ($arr = mysql_fetch_assoc($res32))
{
SQL_Query_exec("UPDATE users SET forumbanned = 'no', forumbanneduntil = '0000-00-00 00:00:00' WHERE id = $arr[id]");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES(0, $arr[id], $dt, $msg, 0)");
}
} $query = "SELECT * FROM motm WHERE id='$CURUSER[id]' && month = ".date("m")." && year = ".date("y")."";
$result = SQL_Query_exec($query);
$motm = mysql_fetch_array($result);
$points = $motm['points'];
echo "Activity Bonus: <b>$points</b>";
$sbmessage = "New Torrent: [url=".%24site_config%5B"]."/torrents-details.php?id=".$id."]".$torrent."[/url] just been uploaded!";
SQL_Query_exec("INSERT INTO shoutbox (msgid, user, message, date, userid, room) VALUES (NULL, 'System', ".sqlesc($sbmessage).", '".get_date_time()."', '100', '0')");
[/code]
# Upload Manager
$LANG["INFO_UP_BONUS"] = "<p style='margin-top:10px; margin-bottom:20px' align='center'>
Choose the class at you want to modify the upload or preserves <b>To all members</b><br />
Write a value for the option which you have chosen and click on <b>Submit</b> button.<br />
Marks <b>System</b> if you want that it be the sender of messages.
</p>";
$LANG["UP_MANAGER"] = "Upload Manager";
$LANG["UP_UPDATED"] = "Operation performed successfully.";
$LANG["UP_ADD"] = "<b>ADD</b> to current upload:";
$LANG["UP_DED"] = "<b>DEDUCT</b> from current upload:";
$LANG["UP_MUL"] = "<b>MULTIPLY</b> current upload by:";
$LANG["UP_DIV"] = "<b>DIVIDE</b> current upload by:";
$LANG["UP_REP"] = "<b>REPLACE</b> current upload with:";
$LANG["UP_ADDED"] ="%s added %s GB Upoad to all members from class: %s";
$LANG["UP_DEDUCTED"] ="%s deducted %s GB Upoad to all members from class: %s";
$LANG["UP_MULTIPLIED"] ="%s multiplied by %s Upoad to all members from class: %s";
$LANG["UP_DIVIDED"] ="%s divided by %s Upoad to all members from class: %s";
$LANG["UP_REPLACED"] ="%s replaced with %s Upoad to all members from class: %s";
$LANG["TO_ALL_MEMBERS"] = "To all Members";
$LANG["ALL1"] = "All";
$LANG["SUBJECT_ADD"] = "We have added GB Upload to your account";
$LANG["MSG_ADD"] = "Hey, we have added %s upload to your account!
Please do not think this is a time to not seed. The same rules as always apply and we hate leechers...
So, if you're not a leecher, download something nice and enjoy!nClass Concerned: %s.";
$LANG["SUBJECT_DED"] = "We have deducte GB Upload to your account";
$LANG["MSG_DED"] = "Hey, we have deducte %s upload to your account!
Please do not think this is a time to not seed. The same rules as always apply and we hate leechers...
So, if you're not a leecher, download something nice and enjoy!nClass Concerned: %s.";
$LANG["SUBJECT_MUL"] = "We have MULTIPLIED your upload";
$LANG["MSG_MUL"] = "Hey, we have MULTIPLIED your upload by %s!
Please do not think this is a time to not seed. The same rules as always apply and we hate leechers...
So, if you're not a leecher, download something nice and enjoy!nClass Concerned: %s";
$LANG["SUBJECT_DIV"] = "We have DIVIDED your upload";
$LANG["MSG_DIV"] = "Hey, we have DIVIDED your upload by %s!
Please do not think this is a time to not seed. The same rules as always apply and we hate leechers...
So, if you're not a leecher, download something nice and enjoy!nClass Concerned: %s";
$LANG["SUBJECT_REP"] = "We have REPLACED your upload";
$LANG["MSG_REP"] = "Hey, we have REPLACED your upload with %s!
Please do not think this is a time to not seed. The same rules as always apply and we hate leechers...
So, if you're not a leecher, download something nice and enjoy!nClass Concerned: %s";
#-----------------------------------------------
# DEDUCT
#-----------------------------------------------
if($_POST['gig2'])
{
if ( !is_numeric($_POST['class']))
{
$res = SQL_Query_exec("SELECT id,uploaded FROM users");
$arr1[0] = T_("ALL1");
}
else
{
$res = SQL_Query_exec("SELECT id,uploaded FROM users WHERE class=".$_POST['class']." AND status = 'confirmed'");
$res1 = SQL_Query_exec("SELECT level FROM groups WHERE group_id=".$_POST['class']."");
$arr1 = mysql_fetch_row($res1);
}
$sender = ( $_POST["fromsystem"] == "yes" ) ? "0" : $CURUSER["id"];
$subject = T_("SUBJECT_DED");
$msg = sprintf( T_("MSG_DED"), $_POST['gig2'], $arr1[0]);
while($arr = mysql_fetch_row($res))
{
$up_value = strtobytes($_POST['gig2']);
if (($arr[1]-$up_value) >= 0)
SQL_Query_exec("UPDATE users SET uploaded = uploaded - ".$up_value." WHERE id=".$arr[0]." AND status = 'confirmed'");
else
SQL_Query_exec("UPDATE users SET uploaded = 0 WHERE id=".$arr[0]." AND status = 'confirmed'");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, subject, msg, poster) VALUES ($sender, $arr[0], '".get_date_time()."', ".sqlesc($subject).", ".sqlesc($msg).", $sender)");
}
write_log( sprintf(T_("UP_DEDUCTED"), class_user($CURUSER["username"]), $_POST['gig2'], htmlspecialchars($arr1[0])) );
autolink("upload-bonus.php", T_("UP_UPDATED"));
}
SQL_Query_exec("UPDATE users SET uploaded = uploaded - ".strtobytes($_POST['gig2'])." WHERE status = 'confirmed'");
Thanks mate :)
<?
require_once("backend/functions.php");
dbconn();
if (!$CURUSER)
{
Header("");
die;
}
$subs_dir = "".str_replace("","/",getcwd())."".$site_config['subs_dir']."";
$filename = substr($HTTP_SERVER_VARS["PATH_INFO"], strrpos($HTTP_SERVER_VARS["PATH_INFO"], "/") + 1);
if (!$filename)
die("File name missingn");
$filename = sqlesc($filename);
$res = SQL_Query_exec("SELECT * FROM subs WHERE filename=$filename");
$arr = mysql_fetch_assoc($res);
if (!$arr)
die("Not foundn");
SQL_Query_exec("UPDATE subs SET hits=hits+1 WHERE id=$arr[id]");
$file = "$subs_dir/$arr[filename]";
if (!is_file($file))
die("File not foundn");
$f = fopen($file, "rb");
if (!$f)
die("Cannot open filen");
header("Content-Length: " . filesize($file));
header("Content-Type: application/octet-stream");
do
{
$s = fread($f, 4096);
print($s);
}
while (!feof($f));
exit;
?>
CREATE TABLE `subs` (
`id` int(10) unsigned NOT NULL auto_increment,
`title` varchar(255) NOT NULL default '',
`filename` varchar(255) NOT NULL default '',
`cd` int(10) unsigned NOT NULL default '0',
`frame` varchar(255) NOT NULL default '',
`comment` text NOT NULL,
`added` datetime default NULL,
`size` int(10) unsigned NOT NULL default '0',
`uppedby` int(10) unsigned NOT NULL default '0',
`url` varchar(255) NOT NULL default '',
`hits` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Add in backend/config.php the next line:
$site_config['subs_dir'] = '/uploads/subs';


<?php
require_once("backend/functions.php");
require_once("backend/bbcode.php");
dbconn();
$id = (int)$_GET["id"];
$type = $_GET["type"];
$edit = (int)$_GET["edit"];
$delete = (int)$_GET["delete"];
if ($edit == 1 || $delete == 1 || $_GET["takecomment"] == 'yes') loggedinonly();
if (!isset($id) || !$id || ($type != "torrent" && $type != "news"))
show_error_msg("ERROR", T_("ERROR"), 1);
if ($edit=='1'){
$row = mysql_fetch_assoc(SQL_Query_exec("SELECT user FROM comments WHERE id=$id"));
if (($type == "torrent" && $CURUSER["edit_torrents"] == "no" || $type == "news" && $CURUSER["edit_news"] == "no") && $CURUSER['id'] != $row['user'])
show_error_msg("ERROR","You cant do this!",1);
$save = (int)$_GET["save"];
if($save){
$text = sqlesc($_POST['text']);
if ($type == "torrent") {
$res = SQL_Query_exec("SELECT torrent FROM comments WHERE id=$id");
$row = mysql_fetch_assoc($res);
$idback = $row["torrent"];
$query="UPDATE comments SET text=$text WHERE id=$id";
$result=SQL_Query_exec($query);
write_log("<a href=account-details.php?id=".$CURUSER['id']."><b>".$CURUSER['username']."</a></b> has edited comment ID: <b>$id</b> from torrent: [<a href=torrents-details.php?id=$idback><b>$idback</b></a>]");
autolink("torrents-details.php?id=$idback", "Comment was edited successfully.");
}
if ($type == "news") {
$res = SQL_Query_exec("SELECT news FROM comments WHERE id=$id");
$row = mysql_fetch_assoc($res);
$idback = $row["news"];
$query="UPDATE comments SET text=$text WHERE id=$id";
$result=SQL_Query_exec($query);
write_log("<a href=account-details.php?id=".$CURUSER['id']."><b>".$CURUSER['username']."</a></b> has edited comment ID: <b>$id</b> from News ID: [<a href=comments.php?type=news&id=$idback><b>$idback</b></a>]");
autolink("comments.php?type=news&id=$idback", "Comment was edited successfully.");
}
}
stdhead("Edit Comment");
$res = SQL_Query_exec("SELECT * FROM comments WHERE id=$id");
$arr = mysql_fetch_array($res);
begin_frame("Edit Comment");
print("<center><b>Edit comment </b><p>n");
print("<form method="post" name="comment" action="comments.php?type=$type&edit=1&save=1&id=$id">n");
print textbbcode("comment","text", htmlspecialchars($arr["text"]));
print("<p><input type="submit" value="Submit Changes" /></p></form></center>n");
end_frame();
stdfoot();
die();
}
if ($delete=='1'){
if ($CURUSER["delete_news"] == "no" && $type == "news" || $CURUSER["delete_torrents"] == "no" && $type == "torrent")
show_error_msg("ERROR","You cant do this!",1);
if ($type == "torrent") {
$res = SQL_Query_exec("SELECT torrent FROM comments WHERE id=$id");
$row = mysql_fetch_assoc($res);
if ($row["torrent"] > 0) {
SQL_Query_exec("UPDATE torrents SET comments = comments - 1 WHERE id = $row[torrent]");
}
$idback = $row["torrent"];
SQL_Query_exec("DELETE FROM comments WHERE id = $id");
write_log("<a href=account-details.php?id=".$CURUSER['id']."><b>".$CURUSER['username']."</a></b> has deleted comment ID: <b>$id</b> from torrent: [<a href=torrents-details.php?id=$idback><b>$idback</b></a>]");
autolink("torrents-details.php?id=$idback", "Comment was deleted successfully.");
}
if ($type == "news") {
$res = SQL_Query_exec("SELECT news FROM comments WHERE id=$id");
$row = mysql_fetch_assoc($res);
$idback = $row["news"];
SQL_Query_exec("DELETE FROM comments WHERE id = $id");
write_log("<a href=account-details.php?id=".$CURUSER['id']."><b>".$CURUSER['username']."</a></b> has deleted comment ID: <b>$id</b> from News ID: [<a href=comments.php?type=news&id=$idback><b>$idback</b></a>]");
autolink("comments.php?type=news&id=$idback", "Comment was deleted successfully.");
}
}
stdhead(T_("COMMENTS"));
//take comment add
if ($_GET["takecomment"] == 'yes'){
$body = $_POST['body'];
if (!$body)
show_error_msg(T_("ERROR"), T_("YOU_DID_NOT_ENTER_ANYTHING"), 1);
if ($type =="torrent"){
SQL_Query_exec("UPDATE torrents SET comments = comments + 1 WHERE id = $id");
}
SQL_Query_exec("INSERT INTO comments (user, ".$type.", added, text) VALUES (".$CURUSER["id"].", ".$id.", '" .get_date_time(). "', " . sqlesc($body).")");
if (mysql_affected_rows() == 1)
show_error_msg(T_("COMPLETED"), "Your Comment was added successfully.", 0);
else
show_error_msg(T_("ERROR"), T_("UNABLE_TO_ADD_COMMENT"), 0);
}//end insert comment
//NEWS
if ($type =="news"){
$res = SQL_Query_exec("SELECT * FROM news WHERE id = $id");
$row = mysql_fetch_array($res);
if (!$row){
show_error_msg(T_("ERROR"), "News id invalid", 0);
stdfoot();
}
begin_frame(T_("NEWS"));
echo htmlspecialchars($row['title']) . "<br /><br />".format_comment($row['body'])."<br />";
end_frame();
}
//TORRENT
if ($type =="torrent"){
$res = SQL_Query_exec("SELECT id, name FROM torrents WHERE id = $id");
$row = mysql_fetch_array($res);
if (!$row){
show_error_msg(T_("ERROR"), "News id invalid", 0);
stdfoot();
}
echo "<center><b>Comments for:</b> <a href='torrents-details.php?id=".$row['id']."'>".htmlspecialchars($row['name'])."</a></center><br />";
}
if($CURUSER["commentbanned"]=="yes")
show_error_msg("Access Denied","You was banned to use comments!",0);
else {
begin_frame(T_("COMMENTS"));
$subres = SQL_Query_exec("SELECT COUNT(*) FROM comments WHERE $type = $id");
$subrow = mysql_fetch_array($subres);
$commcount = $subrow[0];
if ($commcount) {
list($pagertop, $pagerbottom, $limit) = pager(25, $commcount, "comments.php?id=$id&type=$type&");
$commquery = "SELECT comments.id, text, user, comments.added, avatar, signature, username, title, class, uploaded, downloaded, privacy, donated FROM comments LEFT JOIN users ON comments.user = users.id WHERE $type = $id ORDER BY comments.added DESC $limit";
$commres = SQL_Query_exec($commquery);
}else{
unset($commres);
}
if ($commcount) {
print($pagertop);
commenttable($commres, $type);
print($pagerbottom);
}else {
print("<br /><b>" .T_("NOCOMMENTS"). "</b><br />n");
}
echo "<center>";
echo "<form name="comment" method="post" action="comments.php?type=$type&id=$id&takecomment=yes">";
echo textbbcode("comment","body")."<br />";
echo "<input type="submit" value="Add Comment" />";
echo "</form></center>";
end_frame();
}
stdfoot();
?>
//===| Start Auto Promote/Demote Users |===//
//===| config
$gigs = 50*1073741824; # 50 GB / uploaded amount for promote as power user
$minratio = 0.95; # ratio for demotion to user
$delay = sqlesc(get_date_time(gmtime() - 86400*30)); # Joined > 1 month
//===| auto promote to power user
$res = SQL_Query_exec("SELECT id, username, modcomment FROM users WHERE class = 1 AND warned = 'no' AND added < $delay AND uploaded >= $gigs AND uploaded >= downloaded");
$time = get_date_time();
while ($arr = mysql_fetch_assoc($res)) {
$username = $arr[username];
$modcomment = $arr[modcomment];
$modcomment2 = gmdate("d-M-Y") . " - Has been promoted by System to Power User class n";
$modcomment = $modcomment2 . "" . $modcomment;
$modcom = sqlesc($modcomment);
SQL_Query_exec("UPDATE users SET class = 2, modcomment = CONCAT($modcom,modcomment) WHERE id = $arr[id]");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, $arr[id], '$time', 'Congratulations, you were automatically promoted to Power User class. Please note that if your ratio drops below ".$minratio." at any time, you will be demoted back to User', 'You have been promoted as Power User')");
write_log("<a href=account-details.php?id=$arr[id]><b>$username</b></a> has been promoted by System to <b>Power User</b> class");
}
//===| auto demote to user
$res = SQL_Query_exec("SELECT id, username, modcomment FROM users WHERE class = 2 AND uploaded / downloaded < $minratio");
while ($arr = mysql_fetch_assoc($res)) {
$username = $arr[username];
$modcomment = $arr[modcomment];
$modcomment2 = gmdate("d-M-Y") . " - Has been demoted by System to User class n";
$modcomment = $modcomment2 . "" . $modcomment;
$modcom = sqlesc($modcomment);
SQL_Query_exec("UPDATE users SET class = 1, modcomment = CONCAT($modcom,modcomment) WHERE id = $arr[id]");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, $arr[id], '$time', 'You were automatically demoted as User. That happened because your ratio dropped below ".$minratio."', 'You have been demoted as User')");
write_log("<a href=account-details.php?id=$arr[id]><b>$username</b></a> has been demoted by System to <b>User</b> class");
}
//===| End Auto Promote/Demote Users |===//
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 |====//
?>