<?

require_once("include/bittorrent.php");

ob_start("ob_gzhandler");

dbconn();


$search = trim($HTTP_GET_VARS['search']);
$query = "username = " . sqlesc("$search") . " AND status='confirmed'";

$res = mysql_query("SELECT COUNT(*) FROM users WHERE $query") or sqlerr();
$arr = mysql_fetch_row($res);

$res = mysql_query("SELECT * FROM users WHERE $query ORDER BY username") or sqlerr();
$num = mysql_num_rows($res);

if($num < 1) {
echo $search." - No such user, please try again.";
}

if($num > 0) {
$arr = mysql_fetch_assoc($res);

$ratio = (($arr["downloaded"] > 0) ? ($arr["uploaded"] / $arr["downloaded"]) : "0.00");


print($arr[username]." - Class: "."(".get_user_class_name($arr["class"]).") - Uploaded: (".mksize($arr[uploaded]).") - Downloaded: (".mksize($arr[downloaded]).") - Ratio: (".number_format($ratio, 2).")");
}

die;

?> 