Location: PHPKode > projects > Trunk.net > ratio-warned.php
<?php

require "include/functions.php";

dbconn(false);
loggedinorreturn();
if (get_user_class() < UC_MODERATOR)
	stderr("Error", "Access is denied.");
stdhead("Ratio warned users");

#======================================================================#
# Ratio Warn System - Warned Users
#======================================================================#
{
    $resrws = mysql_query("SELECT * FROM ratiowarn WHERE warned='yes'");
	$reqrws = mysql_fetch_assoc($resrws);
	begin_frame("Ratio Warn System - Warned Users", center);
    if ($reqrws < 1){
        echo "No users have been warned for maintaining poor ratios.";
    }else{
        $res_rws = mysql_query("SELECT *, TO_DAYS(NOW()) - TO_DAYS(warntime) as difference FROM ratiowarn WHERE warned='yes'");
        $num = mysql_num_rows($res_rws);
        begin_table();
        print("<tr><td class=alt3 align=left><font size=1 face=Verdana color=red>User</td><td class=alt3 align=left><font size=1 face=Verdana color=red>Ratio</td><td class=alt3 align=left><font size=1 face=Verdana color=red>Warned</td><td class=alt3 align=left><font size=1 face=Verdana color=red>Banned</td><td class=alt3 align=left><font size=1 face=Verdana color=red>Time Until Ban</td></tr>\n");
        for ($i = 0; $i < $num; ++$i)
        {
            $arr = mysql_fetch_array($res_rws);
            $userid = $arr['userid'];
            $userr = mysql_query("SELECT username, uploaded, downloaded FROM users WHERE id='$userid'");
            $userq = mysql_fetch_assoc($userr);
            $user = $userq['username'];
            $ratio = number_format($userq["uploaded"] / $userq["downloaded"], 2);
            $banned = $arr['banned'];
            
            if($banned == 'no'){
                $timeleft = ($arr['difference'] - $RATIOWARN_BAN)/-1;
            }else{
                $timeleft = "null";
            }
            print("<tr><td class=alt1><a href=userdetails.php?id=$userid>$user</a></td><td class=alt2>$ratio</td><td class=alt1 align=left>yes</td><td class=alt1 align=left>$banned</td><td class=alt2>$timeleft days</td></tr>\n");
        }
        end_table();
    }//display warned users

    end_frame();
}   //end rws-warned
//end here
stdfoot();
hit_end();
?>
Return current item: Trunk.net