My Assistant
Logged in as: OPPZeroCool ( Log Out )
My Controls · View New Posts · My Assistant · My Friends · 1 New Messages
If you would like to advertise your Hosting, Services or Products on Filesoup, please contact Geeker for a quote.
Torrent Per Page and Sub Pages,
T-Xore |
May 24 2007, 03:47 AM
Post #16
| |
Spam Soup Group: Admin Posts: 1,377 Joined: 16-January 04 From: Florida Member No.: 61,222 |
I'll be more active in here and again
if there are things posted such as plain blatant copies of CSS etc let me
know and I will remove them. I have talked to Geeker and Snookered as well
regarding some issues regarding things such as this. This is in fact a section for people to ask question about code and how to for trackers/indexers/crawlers etc. And I do agree with the Hosting type questions and I thank you Jaggi for giving him the correct name to use to look up as you are 100% correct that some people may not know what to look for. And thank you also to phrostwave for giving a postive response as well. just pointing out that maybe he didn't
know it was called pagination that is why i pointed out and i'll make it
known that the term wasn't used in this thread till i pointed it out.
Knowing what you want to do and the professional term for it can be two
different things. In my honest opinion i have no objection with the person
who made this thread and thats why i posted a reply. I do however agree
that threads in this forum can get messy but not in the form you mentioned
i refer to people asking for hosting, thats one thing that REALLY gets on
my nerves, i've already spoken to snookered about it and he's promised to
talk to geeker about it, he prolly forgot so i'll chase him up again . But would like to see a seperate forum for host
requests i truely believe that subject has no place in this forum. People
asking for coding relating to a existing script and that being a tracker,
indexer, crawler or site i feel is fine in this
forum. -------------------- Mini Tracker Public Announce URL: http://hustlers-place.com/sbt/announce.php
Hustler's Place Lite Tracker: http://hustlers-place2.com/ttlite/index.php
Hustler's Place Crawler Using Pktorrents: http://hustlers-place2.com/crawler/index.php
Hustler's Place BT Lister: http://hustlers-place.com/mybit/index.php
(New) Hustler's Place Topsites Site: http://hustlers-place.com/topsite/index.php
Hustler's Place VIPTracker: http://hustlers-place2.com/viptracker/index.php This one
requires
you to be an active member of our forums!
|
| |
May 24 2007, 04:28 AM
Post #17
| |
Spam Soup Group: Contributor Posts: 120 Joined: 22-September 05 Member No.: 313,949 |
Pagination
Script subcat.php CODE
<? require_once "config.php"; connect ($dbhost, $dbuser, $dbpass, $database); $sort = tsort ($_GET['sort']); $numreg = 3; // Number the pages 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); // Non htmlentities are allowed in title (converted automaticly by function stheader ('Sub categoria : '.$namerow[0].' > '.$namerow[2]); if ($count == 0){ echo '<h1>Nenhum torrent encontrado</h1>'; footer(); die; } echo '<div id="bread-navi"><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.' torrents em '.$namerow[2].'</h1>'; echo ' <table class="tor" width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <th width="15%"><a href="subcat.php?id='.strip_tags(trim($_GET['id'])).'&sort=1">Data</a></th> <th><a href="subcat.php?id='.strip_tags(trim($_GET['id'])).'&sort=3">Nome</a></th> <th width="9%"><a href="subcat.php?id='.strip_tags(trim($_GET['id'])).'&sort=4">Tamanho</a></th> <th width="4%"><a href="subcat.php?id='.strip_tags(trim($_GET['id'])).'&sort=5">UL</a></th> <th width="4%"><a href="subcat.php?id='.strip_tags(trim($_GET['id'])).'&sort=6">DL</a></th> <th width="5%">Saúde</th> </tr>'; while ($row = mysql_fetch_array($result)){ extract($row); echo '<tr>'; echo '<td>'.substr($added,-0).'</td>'; // limitar caracteres no nome do torrent $sub = substr($torrentname,0, 65); // colocar ... quando o arquivo possuir mais que 50 caracteres $strlen_var = strlen($torrentname); if ($strlen_var >= 65) { echo '<td><a href="download.php?id='.$hash.'"><img src="images/d.gif" title="Fazer download do torrent" align="absmiddle"/></a> '.regicon($registration,$tracker).' '.desc($description).'<a href="details.php?id='.$id.'" title="'.$torrentname.'">'.$sub.'...</a></td>'; } else { echo '<td><a href="download.php?id='.$hash.'"><img src="images/d.gif" title="Fazer download do torrent" align="absmiddle"/></a> '.regicon($registration,$tracker).' '.desc($description).'<a href="details.php?id='.$id.'">'.$sub.'</a></td>'; } echo '<td align="right">'.torsize($size).'</td>'; echo '<td class="s">'.getpeer($seeds).'</td>'; echo '<td class="p">'.getpeer($peers).'</td>'; echo '<td width="48" align="center"><img src="images/h'.health($peers, $seeds).'.png"></td>'; echo '</tr>'; } echo '</table>'; //Paginação echo "<br>"; // Vai servir só para dar uma linha de espaço entre a paginação e o conteúdo if ($quantreg%$numreg==0){ $quant_pg = intval($quantreg/$numreg); $quant_pg++; } else{ $quant_pg = ceil($quantreg/$numreg); $quant_pg++; } echo'<div class="pages">'; //Nao aparecer nada quando o numero minimo for respeitado if ($quantreg <= $numreg){ echo ''; footer(); die; } // Verifica se esta na primeira página, se nao estiver ele libera o link para anterior if ($_GET['pg'] > 0){ echo "<a href=".$_SERVER['PHP_SELF']."?id=".strip_tags(trim($_GET['id']))."&pg=".($_GET['pg']-1)."><b>« Anterior</b></a>"; } else{ echo ""; } // Faz aparecer os numeros das página entre o ANTERIOR e PROXIMO for($i_pg=1; $i_pg<$quant_pg;$i_pg++){ // Verifica se a página que o navegante esta e retira o link do número para identificar visualmente 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> "; } } // Verifica se esta na ultima página, se nao estiver ele libera o link para próxima if (($_GET['pg']+2) < $quant_pg){ echo "<a href=".$_SERVER['PHP_SELF']."?id=".strip_tags(trim($_GET['id']))."&pg=".($_GET['pg']+1)."><b>Próximo »</b></a>"; } else{ echo ""; } //Fim da paginação echo "<br />"; footer(); ?> -------------------- GIGANOVA.org T-Xore Mods in Test http://teste.dannlopes.cjb.net/ |
| |
May 24 2007, 05:27 AM
Post #18
| |
DJ Taktikz / STR Records Group: Member Posts: 62 Joined: 7-September 06 Member No.: 411,795 System Specs: (show/hide) 64bit x86 based
AMD 'san diego' 3700+ anthlon processor (2.41G), nforce4-a754 board, 2gb
ram, SATA 200gb HD + 350gb HD, 10MB line, nforce-anux 1.0 OS (my buddies
version of linux). same cpu, same board, same ram, SATA 200gb, usb 200gb, windows xpsp2. BAD MUTHAS! |
guibean rules! i cleaned it up a little for people who want to use this on the ak nova, it shows 25 torrents per page, and is translated from Portuguese to English [edit]> the sorting buttons dont work yet, you might want to unlink them if you dont feel like making up that part of the code. CODE
<? /* Subcategory "pagination" by guibean */ require_once "config.php"; connect ($dbhost, $dbuser, $dbpass, $database); $sort = tsort ($_GET['sort']); $numreg = 25; // Number the pages 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); $torrentname = str_replace("(","",$torrentname); $torrentname = str_replace(")","",$torrentname); $torrentname = str_replace("net","",$torrentname); $torrentname = str_replace("co.uk","",$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="pages">'; 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>« Previous</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 "<br />"; footer(); ?> This post has been edited by phrostwave: May 24 2007, 07:06 AM -------------------- may 15, 2007 releases - ak nova 1.4 (snapshot), ak tracker
1.0.1 (snapshot). t-xore 0.4 preconfigured with ibitzy, registration captcha (ive seen it on 18 sites so far!), admin search, user search, and tons of other stuff by me and various other filesoup members! bNova stylesheet for ak nova 1.4 look for ak nova 1.7 soon! lots of features like forums, dhtml/ajax, two mass scrapes, nicer admin area, plus a ton of other stuff!! |
| |
May 25 2007, 04:04 AM
Post #19
| |
Spam Soup Group: Contributor Posts: 120 Joined: 22-September 05 Member No.: 313,949 |
it would like to
know if somebody could help me to create a paging limit Exemple When to pass of the limit of the desired pages to add “…” equal the image above help me phrostwave please |
| |
May 25 2007, 05:19 AM
Post #20
| |
DJ Taktikz / STR Records Group: Member Posts: 62 Joined: 7-September 06 Member No.: 411,795 System Specs: (show/hide) 64bit x86 based
AMD 'san diego' 3700+ anthlon processor (2.41G), nforce4-a754 board, 2gb
ram, SATA 200gb HD + 350gb HD, 10MB line, nforce-anux 1.0 OS (my buddies
version of linux). same cpu, same board, same ram, SATA 200gb, usb 200gb, windows xpsp2. BAD MUTHAS! |
the code below doesnt work yet, but
its an idea on how to limit the number paginations to be displayed per
page. CODE
$max = 'limit ' .($pagenum - 1) * $page_rows
.',' .$page_rows; i will post it when i get it working This post has been edited by phrostwave: May 25 2007, 05:22 AM |
| |
May 25 2007, 06:28 PM
Post #21
| |
Spam Soup Group: Contributor Posts: 120 Joined: 22-September 05 Member No.: 313,949 |
Complete CODE
<? require_once "config.php"; connect ($dbhost, $dbuser, $dbpass, $database); stheader(''); $rpp = 2; // Quantos registros por página vai ser mostrado if (!isset($pg)){ $pg = 0; } $inicial = $_GET['pg'] * $rpp; $result = mysql_query("SELECT * FROM torrents LEFT JOIN categories ON torrents.subcat = categories.subid WHERE posted_by='".strtolower($_GET['usuario'])."' ORDER BY added DESC LIMIT $inicial,$rpp") or die (mysql_error()); $result2 = mysql_query("SELECT * FROM torrents LEFT JOIN categories ON torrents.subcat = categories.subid WHERE posted_by='".strtolower($_GET['usuario'])."'") or die (mysql_error()); $count = mysql_num_rows($result2); $tr = $count; if (mysql_num_rows($result) == 0){ echo '<div id="bread-navi"><a href="index.php">Home</a> » Usuário não possui nenhum torrent enviado!</div><br />'; echo '<h3><img src="images/award_star_add.png" alt="files" width="16" height="16"> Usuário não possui nenhum torrent enviado!</h3><br />'; echo '<h2>Usuário não enviou nenhum torrent!</h2>'; } else{ $result2 = mysql_query("SELECT uploads FROM users WHERE username ='".$_GET['usuario']."'"); while ($row = mysql_fetch_array($result2)){ extract($row); echo '<div id="bread-navi"><a href="index.php">Home</a> » Torrents enviados por '.$_GET['usuario'].'</div><br />'; echo '<h3><img src="images/award_star_add.png" alt="files" width="16" height="16"> Torrents enviados por '.$_GET['usuario'].' » Total: <span class="r">'.$uploads.'</span> Ativos: <span class="s">'.$count.'</span></h3><br />'; echo ' <table class="tor" width="100%" cellpadding="0" cellspacing="0" border="0"> <tr cellpadding="0" cellspacing="5"> <th width="13%"><a href="index.php?sort=2">Categoria</a></th> <th width="9%"><a href="index.php?sort=1">Data</a></th> <th><a href="index.php?sort=3">Nome</a></th> <th width="9%"><a href="index.php?sort=4">Tamanho</a></th> <th width="5%"><a href="index.php?sort=5">UL</a></th> <th width="5%"><a href="index.php?sort=6">DL</a></th> <th width="5%"><a href="index.php?sort=8">Saúde</a></th></tr>'; } while ($row = mysql_fetch_array($result)){ extract($row); $tz = convert_timestamp($row["added"]); // add this echo '<tr>'; // limitar caracteres no nome da categoria $categoria = substr($subname,0, 13); // inseri (...) quando o arquivo possuir mais caracteres $strlen_var = strlen($subname); if ($strlen_var >= 13){ echo '<td><a href="subcat.php?id='.$subid.'" title="'.$subname.'">'.$categoria.'...</a></td>'; } else{ echo '<td><a href="subcat.php?id='.$subid.'">'.$categoria.'</a></td>'; } echo '<td>'.get_elapsed_time($tz).'</td>'; // limitar caracteres no nome do torrent $sub = substr($torrentname,0, 55); // colocar ... quando o arquivo possuir mais que 50 caracteres $strlen_var = strlen($torrentname); if ($strlen_var >= 55){ echo '<td><a href="download.php?id='.$hash.'"><img src="images/d.gif" title="Fazer download do torrent" align="absmiddle"/></a> '.regicon($registration,$tracker).' '.desc($description).'<a href="details.php?id='.$id.'" title="'.$torrentname.'">'.$sub.'...</a></td>'; } else{ echo '<td><a href="download.php?id='.$hash.'"><img src="images/d.gif" title="Fazer download do torrent" align="absmiddle"/></a> '.regicon($registration,$tracker).' '.desc($description).'<a href="details.php?id='.$id.'">'.$sub.'</a></td>'; } echo '<td align="right">'.torsize($size).'</td>'; echo '<td class="s">'.getpeer($seeds).'</td>'; echo '<td class="p">'.getpeer($peers).'</td>'; echo '<td align="center"><img src="images/h'.health($peers, $seeds).'.png"></td>'; echo '</tr>'; } echo '</table><br />'; } //Paginação // $tr eh total_records e $rpp eh registros por pagina if ($tr%$rpp==0){ $pages = intval($tr / $rpp)-1; } else{ $pages = intval($tr / $rpp); } // calcula quantas paginas serao necessarias if ($tr>0){ $NumRegistroInicial = ($pg*$rpp)+1; if ($pg <> $pages){ $NumRegistroFinal = ($pg*$rpp)+$rpp; } else{ $NumRegistroFinal = $tr; } echo'<div class="pages">'; //Nao aparecer nada quando o numero minimo for respeitado if ($tr <= $rpp){ echo '<br />'; } else { echo "<p align=\"center\">Exibindo Torrents de $NumRegistroInicial a $NumRegistroFinal</p>"; if ($pg <> 0){ $showpage = $pg - 1; echo '<a id=mulink href="'.$PHP_SELF.'?usuario='.$_GET['usuario'].'&pg=0"><< Primeiro</a> '; echo '<a id=mulink href="'.$PHP_SELF.'?usuario='.$_GET['usuario'].'&pg='.$showpage.'">< Anteriores</a> '; } for ($i = $pg-3; $i<$pg; $i++){ $showpage=$i+1; if ($i>=0){ echo '<a id=mulink href="'.$PHP_SELF.'?usuario='.$_GET['usuario'].'&pg='.$i.'">'.$showpage.'</a>'; echo ' '; } } for ($i = $pg; ($i<=$pages AND $i<=($pg+3)); $i++){ $showpage=$i+1; if ($i == $pg){ echo '<a class=currentpage href=#><b>'.$showpage.'</b></a></font> '; } else{ echo '<a id=mulink href="'.$PHP_SELF.'?usuario='.$_GET['usuario'].'&pg='.$i.'">'.$showpage.'</a>'; echo ' '; } } if ($pg < $pages){ $showpage = $pg + 1; echo '<a id=mulink href="'.$PHP_SELF.'?usuario='.$_GET['usuario'].'&pg='.$showpage.'"> Próximas ></a> '; echo '<a id=mulink href="'.$PHP_SELF.'?usuario='.$_GET['usuario'].'&pg='.$pages.'"> Último >></a>'; } } } echo'</div>'; echo "<br /><br />"; footer(); ?> |
| |
Lo-Fi Version | 0.1921 sec -- 13 queries
GZIP Enabled Time is now: 28th May 2007 - 07:25 PM |