<?php

/******************************************************
 * CjOverkill version 4.1.1
 * © Kaloyan Olegov Georgiev
 * http://www.icefire.org/
 * spam@icefire.org
 * 
 * Please read the lisence before you start editing this script.
 * 
********************************************************/

include ("../cj-conf.inc.php");
include ("../cj-functions.inc.php");   
cjoverkill_connect();
 
include ("security.inc.php");

$log_limit="5000";

if (!isset($_GET["id"]) || $_GET["id"]=="") { 
    cjoverkill_print_error("You must select a trade for this"); 
}
$tid=$_GET["id"];
$order_by=$_GET["order_by"];
$sql=@mysql_query("SELECT domain FROM cjoverkill_trades WHERE trade_id=$tid") OR 
  cjoverkill_db_error(mysql_error());
$tmp=@mysql_fetch_array($sql);
extract($tmp);
switch ($order_by){
 case "hour":
    $sql=@mysql_query("SELECT * FROM cjoverkill_cheatreports WHERE trade_id=$tid 
			ORDER BY hour ASC, what DESC LIMIT 0,$log_limit") OR
      cjoverkill_db_error(mysql_error());
    break;
 case "what":
    $sql=@mysql_query("SELECT * FROM cjoverkill_cheatreports WHERE trade_id=$tid 
			ORDER BY what DESC, hour ASC LIMIT 0,$log_limit") OR
      cjoverkill_db_error(mysql_error());
    break;
 default:
    $sql=@mysql_query("SELECT * FROM cjoverkill_cheatreports WHERE trade_id=$tid 
			ORDER BY hour ASC, what DESC LIMIT 0,$log_limit") OR
      cjoverkill_db_error(mysql_error());
    break;
}

    
    
cjoverkill_disconnect();
$tms="Cheat Reports for $domain";

echo ("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
	<html>
	<head>
	<title>$tms</title>
	<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
	<link href=\"../cj-style.css\" rel=\"stylesheet\" type=\"text/css\">
	</head>
	<body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#000000\" vlink=\"#000000\" alink=\"#000000\">
	<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\" align=\"center\"> 
	  <tr>
	    <td colspan=\"2\" align=\"center\"><strong><font size=\"4\">$tms</font></strong></td>
	  </tr> 
	  <tr>
	    <td height=\"2\" colspan=\"4\">&nbsp;</td>
	  </tr>
	  <tr>
	    <td colspan=\"2\"><font size=\"1\"><b><font size=\"2\">Top $log_limit Cheat Reports</font></b></font></td>
	  </tr>
	  <tr>
	    <td colspan=\"2\">&nbsp;</td> 
	  </tr> 
	<tr class=\"toprows\">
	<td width=\"20%\">Hour</td>
	<td width=\"80%\">Reports</td>
	</tr>
	<tr class=\"normalrows\">
	<td align=\"center\"><font size=\"2\"><a href=\"cheatlog.php?id=$tid&order_by=hour\" target=\"_self\">Order</a></font></td>
	<td align=\"center\"><font size=\"2\"><a href=\"cheatlog.php?id=$tid&order_by=what\" target=\"_self\">Order</a></font></td>
	</tr>
	");

while ($tmp=@mysql_fetch_array($sql)) {
    extract ($tmp);
    echo ("<tr align=\"center\">
	    <td>$hour</td>
	    <td align=\"left\">$what</td>
	    </tr>");
}
echo ("<tr>
	<td colspan=\"2\">&nbsp;</td>
	</tr>
	<tr>
	<td colspan=\"2\" align=\"center\"><font size=\"2\"><a href=\"javascript:window.close()\">Close Window</a></font></td>
	</tr>
	</table>
	</body>
	</html>
	");
?>
	
