"JEsaie, post: 91938":
Work fine with me 2.08
update v2.08 ;)
<?php
//
// TorrentTrader v2.x
// This file was last updated: 18/Oct/2008 by Foz
//
//
http://www.basslinebeats.co.uk
//
//
require_once ("backend/functions.php");
dbconn();
stdhead("Bad Ratio Users");
begin_frame("Bad Ratio Users");
if ($site_config["MEMBERSONLY"] && !$CURUSER) {
echo "<br /><br /><b>You Are Not Logged In<br />Only Members Can View Affiliates Please Login or Signup.<br /><br />";
end_frame();
} else{
/* CONFIG */
$maxratio = 0.7; // Maximum ratio to list. Standard = 0.7.
$mindownload = 10737418240; // "Downloaded more than". Standard = 10 GB.
$deleteclass = ADMINISTRATOR; // Minimum and equal class that can delete users.
$drsource = false; // Set to true if you use DR-source. False if you use Official source. Setting is for PM's.
$pmmsg = "Vous avez été averti en raison du faible ratio. Vous avez deux semaines pour l'améliorer. Si vous n'avez pas, vous serez banni. Vérifiez toujours la fonction needseed pour un ratio-coup de pouce ! Il s'agit d'un message système généré. Suppression de compte est également système contrôlé, donc y accéder ! ;)";
/* END CONFIG */
if (!$CURUSER || $CURUSER["control_panel"]!="yes"){
show_error_msg("Error","Sorry you do not have the rights to access this page!",1);
}
if ($_GET['action'] == ""){
if ($_GET['godcomplex'] == "yes")
{
foreach ( $_POST as $key => $ertek )
{
if ( (strpos($key,'cb_') != 0) or ($ertek == -1) ) continue;
else
{
$username=substr($key,3);
}
if ($_POST['warn']){
$req="UPDATE users SET warned = 'yes', warneduntil = DATE_ADD(NOW(), INTERVAL ".(2 * $warnfor)." DAY) WHERE id = '$ertek'";
$res=SQL_Query_exec($req);
}
else if ($_POST['pm']){
$r = SQL_Query_exec("SELECT id AS userid FROM users WHERE id = '$ertek'") or sqlerr();
while($dat=mysql_fetch_assoc($r)){
if($drsource == "true"){
new_msg(0, $dat[userid], $pmmsg); /* DR Source */
}else{
SQL_Query_exec("INSERT INTO messages (subject, sender, receiver, added, msg) VALUES ('Bad Ratio', 0,$dat[userid] , '" . get_date_time() . "', " . sqlesc($pmmsg) .")") or sqlerr(); /* Official Source */
}
}
$res = "PM Sent!";
}
else if ($_POST['disable']){
$req="UPDATE users SET warned = 'yes', enabled = 'no' WHERE id = '$ertek'";
$res=SQL_Query_exec($req);
// write_log("User $username was diabled by $CURUSER[username]");
}
else if ($_POST['delete'] && get_user_class() > $deleteclass){
$req="DELETE FROM users WHERE id = '$ertek'";
$res=SQL_Query_exec($req);
// write_log("User $username was deleted by $CURUSER[username]");
}
if ($res == ''){print("<script language="javascript">alert('No users Warned, Disabled or Deleted!');</script>");}
}
}
function usertable($res, $frame_caption)
{
global $CURUSER;
begin_frame($frame_caption, true);
begin_table();
?>
<br /><table border="0" cellpadding="4" cellspacing="3" width="100%" align="center" class="table_table">
<tr>
<td class="table_head" align="center">User</td>
<td class="table_head" align="center">Uploaded</td>
<td class="table_head" align="center">Downloaded</td>
<td class="table_head" align="center">Ratio</td>
<td class="table_head" align="center">Joined</td>
<td class="table_head" align="center">x</td>
<?php
$cba='';
if ( isset($_GET["select"]) )
{
$select=$_GET["select"];
if ( $select == 'all' ) $cba='checked';
elseif ( $select =='none' ) $cba='';
}
$num = 0;
print("<form method="post" action="leechers.php?godcomplex=yes">");
while ($a = mysql_fetch_assoc($res))
{
foreach ($a as $key => $ertek )
++$num;
$highlight = $CURUSER["id"] == $a["userid"] ? " bgcolor=#BBAF9B" : "";
if ($a["downloaded"])
{
$ratio = $a["uploaded"] / $a["downloaded"];
$color = get_ratio_color($ratio);
$ratio = number_format($ratio, 2);
if ($color)
$ratio = "<font color=$color>$ratio</font>";
}
else
$ratio = "Inf./N/D";
print("</tr><td class=table_col1 align=left $highlight><a href=account-details.php?id=" .
$a["userid"] . "><strong>".class_user($a[username])."</strong></a>");
if($a["warned"] == "yes"){print("<img src="" . $GLOBALS['pic_base_url'] . "/warned.gif" />");}
print("</td><td class=table_col1 align=center $highlight>" . mksize($a["uploaded"]) .
"</td><td class=table_col1 align=center $highlight>" . mksize($a["downloaded"]) .
"</td><td class=table_col1 align=center $highlight>" . $ratio .
"</td><td class=table_col1 align=center>" . gmdate("Y-m-d",strtotime($a["added"])) . " (" .
get_elapsed_time(sql_timestamp_to_unix_timestamp($a["added"])) . " ago)</td>
</td><td class=table_col1 align=center><input type=checkbox name="cb_" . $a["username"] . "" value="" . $a["userid"] . """); if($_GET["select"] == "unwarned" && $a["warned"] == "no"){print("checked");} print(" " . $cba . " /></td></tr></center>");
}
end_table();
end_frame();
}
stdhead("Ratio Under $maxratio/$mindownload byte Downloaded");
$mainquery = "SELECT id as userid, username, added, uploaded, downloaded, warned, uploaded / (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(added)) AS upspeed, downloaded / (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(added)) AS downspeed FROM users WHERE enabled = 'yes'";
$limit = 250;
$order = "added ASC";
$extrawhere = " AND uploaded / downloaded < $maxratio AND downloaded > $mindownload";
$r = SQL_Query_exec($mainquery . $extrawhere . " ORDER BY $order " . " LIMIT $limit") or sqlerr();
print("<center><a href="?select=unwarned">Select unwarned</a> | <a href="?select=all">Select all</a> | <a href="?select=none">Select none</a>");
$mindownloadprint = mksize ($mindownload);
?>
<div style="width:480px;">
<?php
usertable($r, "Ratio Under $maxratio / $mindownloadprint Downloaded");
print("<a href="?action=sendpm">Send Mass PM to All Low Ratio Users</a>");
print("<p><input type="submit" name="pm" value="PM selected" onclick="return confirm('PM all selected users?');" /></p>");
print("<input type="submit" name="disable" value="Disable selected" onclick="return confirm('Disable all selected users?');" />");
if( get_user_class() > $deleteclass ){
print("<input type="submit" name="delete" value="Delete selected" onclick="return confirm('Are you bloody sure you want to delete all these users!?');" />");
}
print("</form>");
?>
</div>
<?php
if ($_GET['taking'] == "takepm"){
if ($HTTP_SERVER_VARS["REQUEST_METHOD"] == "POST"){
$dt = sqlesc(get_date_time());
$msg = $_POST['msg'];
if (!$msg)
stderr("Error","Please Type In Some Text");
$query = "SELECT id as userid, username, added, uploaded, downloaded, warned, uploaded / (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(added)) AS upspeed, downloaded / (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(added)) AS downspeed FROM users WHERE enabled = 'yes'";
$limit = 250;
$order = "added ASC";
//$order = "uploaded / downloaded ASC, downloaded DESC";
$extrawhere = " AND uploaded / downloaded < $maxratio AND downloaded > $mindownload";
$r = SQL_Query_exec($mainquery . $extrawhere . " ORDER BY $order " . " LIMIT $limit") or sqlerr();
while($dat=mysql_fetch_assoc($r)){
if($drsource == "true"){
new_msg(0, $dat[userid], $msg); /* DR Source */
}else{
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg) VALUES (0,$dat[userid] , '" . get_date_time() . "', " . sqlesc($msg) .")") or sqlerr(); /* Official Source */
}
}
SQL_Query_exec("INSERT INTO leecherspmlog ( user , date ) VALUES ( $CURUSER[id], $dt)") or sqlerr();
header("Refresh: 0; url=leechers.php");
}
}
if ($_GET['action'] == "sendpm") {
stdhead("Users that are bad");
?>
<table class="main" width="750" border="0" cellspacing="0" cellpadding="0"><tr><td class="embedded">
<div align="center">
<h1>Mass Message to All Bad Users</a></h1>
<form method="post" action="leechers.php?taking=takepm">
<?php
if ($_GET["returnto"] || $_SERVER["HTTP_REFERER"])
{
?>
<input type=hidden name=returnto value=<?=$_GET["returnto"] ? $_GET["returnto"] : $_SERVER["HTTP_REFERER"]?>>
<?php
}
?>
<table cellspacing=0 cellpadding=5>
<tr>
<td>Send Mass Messege To All Bad Users<br />
<table style="border: 0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td style="border: 0"> </td>
<td style="border: 0"> </td>
</tr>
</table>
</td>
</tr>
<tr><td><textarea name=msg cols=120 rows=15><?=$pmmsg?></textarea></td></tr>
<tr>
<tr><td colspan=2 align=center><input type="submit" value="Send" class="btn"></td></tr>
</table>
<input type="hidden" name="receiver" value=<?=$receiver?>>
</form>
</div></td></tr></table><center>
<br />
NOTE: No HTML Code Allowed. (NO HTML)
<?php
}
print ("<br />");
if ($site_config["MEMBERSONLY"] && !$CURUSER) {
echo "<br /><br /><b>You Are Not Logged In<br />Only Members Can View Affiliates Please Login or Signup.<br /><br />";
} else{
?>
<center>---Coded by foz © For Torrent-Trader v2.x---</center>
<?php
}
}
end_frame();
stdfoot();
}
?>
Capture.PNG