ExampleReplace
your subcat.php with the following code:
Code:
<?
/*
Subcategory "pagination" by
guibean
Modified for the AK Nova by
phrostwave
*/
require_once "config.php";
connect
($dbhost, $dbuser, $dbpass, $database);
$sort = tsort
($_GET['sort']);
$numreg = 25; // Number of items per
page
if (!isset($pg)){
$pg =
0;
}
$inicial = $_GET['pg'] * $numreg;
$result =
mysql_query("SELECT * FROM torrents LEFT JOIN categories ON
torrents.subcat = categories.subid WHERE subid =
'".strip_tags(trim($_GET['id']))."' $sort LIMIT $inicial,$numreg")
or die (mysql_error());
$result2 = mysql_query("SELECT * FROM
torrents LEFT JOIN categories ON torrents.subcat = categories.subid
WHERE subid = '".strip_tags(trim($_GET['id']))."' $sort") or die
(mysql_error());
$result_subcatname = mysql_query("SELECT
DISTINCT name,catid,subname,subid FROM categories WHERE
subid='".strip_tags(trim($_GET['id']))."'") or die
(mysql_error());
$count =
mysql_num_rows($result2);
$quantreg = $count;
$namerow
= mysql_fetch_row($result_subcatname);
stheader
('Subcategory : '.$namerow[0].' > '.$namerow[2]);
if
($count == 0){
echo '<h1>No torrents yet!
Check back soon =D</h1>';
footer();
die;
}
echo '<div class="location"><a
href="index.php">Home</a> » <a
href="cat.php?id='.$namerow[1].'">'.$namerow[0].'</a>
» <a
href="subcat.php?id='.$namerow[3].'">'.$namerow[2].'</a></div>';
echo
'<h1>'.$count.' total torrents in
'.$namerow[2].'</h1>';
echo '<table class="tor"
width="100%" cellpadding="0" cellspacing="0"
border="0"><tr><th><a
href="?sort=1">Age</a></th><th><a
href="?sort=3">Filename</a></th><th><a
href="?sort=4">Size</a></th><th><a
href="?sort=5">Seeds</a></th><th><a
href="?sort=6">Peers</a></th><th>Health</th></tr>';
while
($row =
mysql_fetch_array($result)){
extract($row);
$torrentname =
str_replace("+"," ",$torrentname);
$torrentname =
str_replace("amp;","",$torrentname);
$torrentname =
str_replace("%","",$torrentname);
$torrentname =
str_replace("[","",$torrentname);
$torrentname =
str_replace("]","",$torrentname);
$torrentname = str_replace("
"," ",$torrentname);
$torrentname =
str_replace("avi","",$torrentname);
$torrentname =
str_replace("S^M","",$torrentname);
$torrentname =
str_replace("com","",$torrentname);
$torrentname =
str_replace("mp3","",$torrentname);
$torrentname =
str_replace("Lynda","",$torrentname);
$torrentname =
str_replace("WWW","",$torrentname);
$torrentname =
str_replace("www","",$torrentname);
$torrentname =
str_replace("-"," ",$torrentname);
$tz =
convert_timestamp($row["added"]); // add this
echo
'<tr>';
echo '<td
width="10%>'.substr($added,-0).'</td>';
echo '<td
width="10%">'.get_elapsed_time($tz).' old!</td>';
echo
'<td width="60%"><a
href="adm/b/torrents/'.$hash.'.torrent"><img
src="images/d.gif" alt="[d]" /></a>
'.regicon($registration,$tracker).' '.desc($description).'<a
href="details.php?id='.$id.'">'.$torrentname.'</a></td>';
echo
'<td width="7%"
class="d">'.torsize($size).'</td>';
echo '<td
width="5%" class="d">'.getpeer($seeds).'</td>';
echo
'<td width="5%"
class="d">'.getpeer($peers).'</td>';
echo '<td
width="3%" align="center"><img src="images/h'.health($peers,
$seeds).'.png"></td>';
echo
'</tr>';
}
echo '</table>';
echo
"<br>";
if ($quantreg%$numreg==0){
$quant_pg = intval($quantreg/$numreg);
$quant_pg++;
}
else{
$quant_pg =
ceil($quantreg/$numreg);
$quant_pg++;
}
echo'<div
class="location">';
if ($quantreg <= $numreg){
echo
'';
footer();
die;
}
if
($_GET['pg'] > 0){
echo "<a
href=".$_SERVER['PHP_SELF']."?id=".strip_tags(trim($_GET['id']))."&pg=".($_GET['pg']-1)."><b>«
Prev</b></a>";
}
else{
echo
"";
}
for($i_pg=1;
$i_pg<$quant_pg;$i_pg++){
if ($_GET['pg'] ==
($i_pg-1)){
echo " <a
class=currentpage
href=#><b>$i_pg</b></a> ";
}
else{
$i_pg2 = $i_pg-1;
echo
" <a
href=".$_SERVER['PHP_SELF']."?id=".strip_tags(trim($_GET['id']))."&pg=$i_pg2><b>$i_pg</b></a> ";
}
}
if (($_GET['pg']+2) < $quant_pg){
echo "<a
href=".$_SERVER['PHP_SELF']."?id=".strip_tags(trim($_GET['id']))."&pg=".($_GET['pg']+1)."><b>Next
»</b></a>";
}
else{
echo "";
}
echo
"</div>";
footer();
?>