[size=18px]A new "Warned Users" code especially for this system[/size]
Into admincp.php replace the warned code with this one:
#======================================================================#
# Warned Users - Updated by BigMax (25-Mar-2013)
#======================================================================#
if ($action == "warned") {
if ($do == "delete") {
if ($_POST["removeall"]) {
$res = SQL_Query_exec("SELECT `id` FROM `users` WHERE `enabled` = 'yes' AND `status` = 'confirmed' AND `warned` = 'yes'");
while ($row = mysql_fetch_assoc($res)) {
SQL_Query_exec("DELETE FROM `warnings` WHERE `active` = 'yes' AND `userid` = '$row[id]'");
SQL_Query_exec("UPDATE `users` SET `warned` = 'no' WHERE `id` = '$row[id]'");
}
} else {
if (!@count($_POST['warned']))
show_error_msg("Error", "Nothing selected", 1);
$ids = array_map("intval", $_POST["warned"]);
$ids = implode(", ", $ids);
SQL_Query_exec("DELETE FROM `warnings` WHERE `active` = 'yes' AND `userid` IN ($ids)");
SQL_Query_exec("UPDATE `users` SET `warned` = 'no' WHERE `id` IN ($ids)");
}
autolink("admincp.php?action=warned", "Entries Confirmed");
}
$perpage = 50;
$count = get_row_count("users", "WHERE enabled = 'yes' AND status = 'confirmed' AND warned = 'yes'");
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, 'admincp.php?action=warned&');
$res = SQL_Query_exec("SELECT `id`, `username`, `class`, `added`, `last_access`, `downloaded`, `uploaded` FROM `users` WHERE `enabled` = 'yes' AND `status` = 'confirmed' AND `warned` = 'yes' ORDER BY `added` DESC $limit");
stdhead("Warned Users");
navmenu();
begin_frame("Warned Users");
$warnedusers = number_format($count);
?>
<div style="margin-top:10px; margin-bottom:10px" align="center"><font size="2">
This page displays all users which are enabled and have active warnings<? if (get_user_class() == 10) { ?>, they can be mass deleted or deleted per user<br />
Please note that if you delete a warning which was for poor ratio, then this is extending the time user has left to expire<? } ?>
<div style="margin-top:10px" align="center">We have <font color="#FF2200"><b><?php echo $warnedusers; ?></b></font> warned user<?php echo ($warnedusers != 1 ? "s" : ""); ?></div></font></div>
<?php If ($count > $perpage) {
print($pagertop);
}
?>
<?php if ($count > 0): ?>
<form id="warned" method="post" action="admincp.php?action=warned&do=delete">
<table border="0" cellpadding="4" cellspacing="0" width="100%" align="center" class="table_table">
<tr>
<th class="table_head" align="left">Username</th>
<th class="table_head" align="left">Class</th>
<th class="table_head" align="left">Uploaded</th>
<th class="table_head" align="left">Downloaded</th>
<th class="table_head" align="left">Ratio</th>
<th class="table_head">Added</th>
<th class="table_head">Last Access</th>
<th class="table_head">Warnings</th>
<th class="table_head"><font color="#FF2200"><b>H</b><small>&</small><b>R</b></font></th>
<? if (get_user_class() >= 6) { ?>
<th class="table_head"><input type="checkbox" name="checkall" onclick="checkAll(this.form.id);" /></th>
<?php } ?>
</tr>
<?php
while ($row = mysql_fetch_assoc($res)):
$qry = SQL_Query_exec("SELECT COUNT(`hnr`) FROM `snatched` WHERE `uid` = '".$row["id"]."' AND `hnr` = 'yes'");
$res2 = mysql_fetch_row($qry);
If ($res2[0] > 0) {
$hnr = "<font style="background-color:B50000" color="#FEFEFE"><b> ".$res2[0]." </b></font>";
} else {
$hnr = "<font color=limegreen><b>No</b></font>";
}
$addeded = date("d-M-Y H:i", utc_to_tz_time($row["added"]));
$joined = ("".get_elapsed_time(sql_timestamp_to_unix_timestamp($row["added"]))." ago");
$lastaccess = (($row["last_access"] == "0000-00-00 00:00:00") ? "Never logged" : "".date("d-M-Y H:i", utc_to_tz_time($row["last_access"]))."");
$lastseen = (($row["last_access"] == "0000-00-00 00:00:00") ? "---" : "".get_elapsed_time(sql_timestamp_to_unix_timestamp($row["last_access"]))." ago" );
$downloaded = "<font color=#FF2200><b>".mksize($row["downloaded"])."</b></font>";
$uploaded = "<font color=limegreen><b>".mksize($row["uploaded"])."</b></font>";
if($row["downloaded"] != 0) {
$ratio = number_format($row["uploaded"] / $row["downloaded"], 2);
} else {
$ratio = "---";
}
$ratio = "<font color=".get_ratio_color($ratio)."><b>$ratio</b></font>";
?>
<tr>
<td class="table_col1"><a href="account-details.php?id=<?php echo $row["id"]; ?>"><b><?php echo class_user($row["username"]); ?></b></a></td>
<td class="table_col2"><?php echo get_user_class_name($row["class"]); ?></td>
<td class="table_col1"><?php echo $uploaded; ?></td>
<td class="table_col2"><?php echo $downloaded; ?></td>
<td class="table_col1"><?php echo $ratio; ?></td>
<td class="table_col2" align="center"><?php echo "".$addeded."<br />".$joined.""; ?></td>
<td class="table_col1" align="center"><?php echo "".$lastaccess."<br />".$lastseen.""; ?></td>
<td class="table_col1" align="center"><font color="#FF2200"><b>Active</b></font>: [<a href="account-details.php?id=<?php echo $row["id"]; ?>#warnings"><b><?php echo number_format(get_row_count("warnings", "WHERE userid = '$row[id]' AND active = 'yes'")); ?></b></a>]
<div style="margin-top:4px"><font color="limegreen"><b>Expired</b></font>: [<a href="account-details.php?id=<?php echo $row["id"]; ?>#warnings"><b><?php echo number_format(get_row_count("warnings", "WHERE userid = '$row[id]' AND active != 'yes'")); ?></b></a>]</div></td>
<td class="table_col1" align="center"><?php echo $hnr; ?></td>
<?php if (get_user_class() >= 6) { ?>
<td class="table_col2" align="center"><input type="checkbox" name="warned[]" value="<?php echo $row["id"]; ?>" /></td>
<?php } ?>
</tr>
<?php endwhile; ?>
<?php if (get_user_class() >= 6) { ?>
<tr>
<td colspan="10" align="right">
<input type="submit" value="Remove Checked" />
<input type="submit" name="removeall" value="Remove All" />
</td>
</tr>
<?php } ?>
</table>
</form>
<?php else: ?>
<center><font size="2"><b>No Warned Users!</b></font></center>
<?php
endif;
If ($count > $perpage) {
print($pagerbottom);
} else {
print("<br />");
}
end_frame();
stdfoot();
}