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

require "include/functions.php";

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

#======================================================================#
# Ratio Warn System - Watched Users
#======================================================================#
{
    $resrws = mysql_query("SELECT * FROM ratiowarn WHERE warned='no'");
	$reqrws = mysql_fetch_assoc($resrws);
	begin_frame("Ratio Warn System - Watched Users", center);
    if ($reqrws < 1){
        echo "There are no users currently being watched for poor ratios.";
    }else{
        $res_rws = mysql_query("SELECT *, TO_DAYS(NOW()) - TO_DAYS(ratiodate) as difference FROM ratiowarn WHERE warned='no'");
        $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>Time Until Warning</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);
            
            $timeleft = ($arr['difference'] - $RATIOWARN_TIME)/-1;
            print("<tr><td class=alt1><a href=userdetails.php?id=$userid>$user</a></td><td class=alt2>$ratio</td><td class=alt1 align=left>no</td><td class=alt2>$timeleft days</td></tr>\n");
        }
        end_table();
    }//display users with poor ratios

    end_frame();
}   //end rws-watched

Return current item: Trunk.net