Location: PHPKode > projects > H-tracker > reqdetails.php
<?
//
//  H-Tracker v0.2
//    http://h-tracker.org
//    Based on TorrentTrader (http://www.torrenttrader.org)
//
//
require "backend/functions.php";

dbconn();

loggedinonly();

stdhead("Request Details");
$id = (int)$_GET["id"];
$res = mysql_query("SELECT * FROM requests WHERE id = $id") or die(mysql_error());
if (mysql_num_rows($res) != 1) show_error_msg("Error", "That request doesn't exist.",1);
$num = mysql_fetch_array($res);
$s = $num["request"];
$filled = $num["filled"];
$catid = $num["cat"];
$catn = mysql_query("SELECT parent_cat,name FROM categories WHERE id='$catid' ") or die(mysql_error());
$catname = mysql_fetch_array($catn);
$pcat = $catname["parent_cat"];
$ncat = $catname["name"];
begin_frame("Fill Request");   
print("<center><table width=90% class=table_head  cellspacing=0 cellpadding=3>\n");
print("<tr><td align=left class=table_col1><B>" . REQUEST . ": </B></td><td width=70% align=left class=table_col1>$num[request]</td></tr>");
print("<tr><td align=left class=table_col1><B>Category: </B></td><td width=70% align=left class=table_col1>$pcat: $ncat</td></tr>");
if ($num["descr"]) {
print("<tr><td align=left class=table_col1><B>" . COMMENTS . ": </B></td><td width=70% align=left class=table_col1>$num[descr]</td></tr>");
}
print("<tr><td align=left class=table_col1><B>" . DATE_ADDED  . ": </B></td><td width=70% align=left class=table_col1>$num[added]</td></tr>");

$cres = mysql_query("SELECT username FROM users WHERE id=$num[userid]");
   if (mysql_num_rows($cres) == 1)
   {
     $carr = mysql_fetch_assoc($cres);
     $username = "$carr[username]";
     $comment = "$carr[descr]";
   }
print("<tr><td align=left class=table_col1><B>Requested by: </B></td><td width=70% align=left class=table_col1>$username</td></tr>");
if ($num["filled"] == NULL) {
print("<tr><td align=left class=table_col1><B>" . VOTE_FOR_THIS . ": </B></td><td width=50% align=left class=table_col1><a href=addrequest.php?id=$id><b>" . VOTES . "</b></a></td></tr>");
if ($CURUSER["class"] >= 4) {    
print("<form method=get action=reqfilled.php>"); 
print("<tr><td align=left class=table_col1><B>To Fill This Request:</B></td><td class=table_col1>Enter ID of the torrent i.e. <br><ee class=success>". $site_config['SITEURL'] . "/torrents-details.php?id=</ee><ee class=error>134</ee><br>U must type just the Torrent ID (<ee class=error>colored</ee>)&nbsp;number</td></tr>");
print("<tr><td align=left class=table_col1>Torrent Number:</td><td class=table_col1><input type=text size=60 name=filledurl value=''><input type=hidden value=$id name=requestid><input type=submit value=\"Fill Request\" >\n</td></tr></form>");
}elseif($site_config['UPLOADAPP'] && $CURUSER["class"] < 4){
print("<tr><td align=left class=table_col1><B>To Fill This Request: </B></td><td width=70% align=left class=table_col1>U must be Uploader  (Request to be <a href=uploadapp.php>Uploader</a>)</td></tr>");
}else{
print("<tr><td align=left class=table_col1><B>To Fill This Request: </B></td><td width=70% align=left class=table_col1>U must be <a class=error>Uploader</td></tr>");                                              
}
}
 print("</table>"); 
print("<p><hr></p><form method=get action=requests.php#add>Or <input type=submit value=\"Add A New Request\"></form></center>");

end_frame();
 
$commentbar = "<p align=center><a class=index href=reqcomment.php?action=add&amp;tid=$id>Add comment</a></p>\n";
$subres = mysql_query("SELECT COUNT(*) FROM comments WHERE req = $id") or die (mysql_error());
$subrow = mysql_fetch_array($subres);
$count = $subrow[0];
begin_frame("Comments");
print("<table width=100%>");
if (!$count) {
print("<tr><td align=center><br>No comments</td></tr>");
}
else {
print("<tr><td>");
list($pagertop, $pagerbottom, $limit) = pager(20, $count, "reqdetails.php?id=$id&", array(lastpagedefault => 1));

$subres = mysql_query("SELECT comments.id, text, user, comments.added, editedby, editedat, avatar, warned, ". "username, title, class, uploaded, downloaded, signature, donated FROM comments LEFT JOIN users ON comments.user = users.id WHERE req = " . "$id ORDER BY comments.id $limit") or die (mysql_error());
$allrows = array();
while ($subrow = mysql_fetch_array($subres))
$allrows[] = $subrow;
print($commentbar);
print($pagertop); 
reqcommenttable($allrows);
print($pagerbottom);
}
print($commentbar);

print("</table><br>"); 
end_frame(); 
stdfoot();
//die;

?>
Return current item: H-tracker