Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > TBDev
Reply
  #1  
Old 19th September 2013, 00:45
ndbj ndbj is offline
Senior Member
 
Join Date: Dec 2012
Portugal
Posts: 35
Default need some help, please
i've moded something to a kind of bookmarks page, but it's something that instead of user see his marks, he can see marks from all other users, and his marks are visible to all others.

so, when i visit this page, it seeks for the id of the user i want to check his marks.
so far so good.

to order the page, i put on it the "ABC....Z All" list, but when i click on some letter, nothing happens, page keeps showing the complete marks list from user.

so, what should i do to correct this?
(thanks in advance)

you should look to this part:
Quote:
$l = chr($i);
$L = chr($i - 32);
$lol = "?id=$id";
if (
$l == $letter)
print(
"&nbsp;&nbsp;&nbsp;<font size=4><b>$L</b></font>\n");
else
print(
"&nbsp;&nbsp;&nbsp;<a href=". $lol ."?letter=$l
PHP Code:
<?
require "include/bittorrent.php";
dbconn();
//loggedinorreturn();

stdhead("Lista");
$id = (int)$_GET["id"];

$page $_GET['page'];
$perpage 1000;

$resc mysql_query("SELECT COUNT(*) FROM bookmarks WHERE bookmarks.userid = $id AND (bookmarks.local = 'Disco' OR bookmarks.local = 'CD/DVD')") or die(mysql_error());
$rowc mysql_fetch_array($resc,MYSQL_NUM);
$count $rowc[0];

$order "torrents.nameorig ASC";

if (
$count)
{
    
//list($pagertop, $pagerbottom, $limit) = pager($bookmarksperpage, $count, "minhalistapublica.php?id=$id?" . $addparam);
    
$res mysql_query("SELECT torrents.id, torrents.ano, torrents.epsl, torrents.epst, torrents.status, torrents.comments, torrents.numfiles, torrents.poster, torrents.miniposter, torrents.nameorig, torrents.name, torrents.size, torrents.category, torrents.filename, torrents.added, torrents.seeders, torrents.leechers, torrents.owner, torrents.times_completed AS complete, bookmarks.id AS bid, bookmarks.torrentid, bookmarks.userid, bookmarks.local, bookmarks.visto FROM bookmarks,torrents WHERE bookmarks.userid = '$id' AND torrents.id = bookmarks.torrentid AND (bookmarks.local = 'Disco' OR bookmarks.local = 'CD/DVD') ORDER BY $order $limit") or sqlerr();
if (
mysql_num_rows($res) > 0)
{
$pages floor($arr[0] / $perpage);
if (
$pages $perpage $arr[0])
  ++
$pages;

if (
$page 1)
  
$page 1;
else
  if (
$page $pages)
    
$page $pages;

for (
$i 1$i <= $pages; ++$i)
  if (
$i == $page)
    
$pagemenu .= "<b>$i</b>\n";
  else
    
$pagemenu .= "<a href=?$q&page=$i><b>$i</b></a>\n";

if (
$page == 1)
  
$browsemenu .= "<b>&lt;&lt; Anterior</b>";
else
  
$browsemenu .= "<a href=?$q&page=" . ($page 1) . "><b>&lt;&lt; Anterior</b></a>";

$browsemenu .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";

if (
$page == $pages)
  
$browsemenu .= "<b>Seguinte &gt;&gt;</b>";
else
  
$browsemenu .= "<a href=?$q&page=" . ($page 1) . "><b>Seguinte &gt;&gt;</b></a>";

$offset = ($page $perpage) - $perpage;

  
$torrents "<table class=main border=1 cellspacing=0 cellpadding=6 align=center>\n" .
    
"
    <td class=colhead align=center>+Info</td>
    <td class=colhead align=center>Anime</td>
    <td class=colhead align=center><img src=pic/buttons/revanidb_mylist.gif>&nbsp;&nbsp;<img src=pic/buttons/seen1.gif></td>
    <td class=colhead align=center>Tipo</td>
    <td class=colhead align=center>Ano</td>
    <td class=colhead align=center>Eps.</td>
    <td class=colhead align=center>Estado</td>
    <td class=colhead align=center>Ficheiros</td>
    <td class=colhead align=center>Fansub</td>
    
</tr>"
;


  while (
$a mysql_fetch_array($res))
  {
                
//$r1 = mysql_query("SELECT id, username FROM users WHERE id=$a[owner]") or sqlerr(__FILE__, __LINE__);
            //$a1 = mysql_fetch_assoc($r1);
            //$owner = "<a href=userdetails.php?id=$a1[id]><b>$a1[username]</b></a>";
            
$r2 mysql_query("SELECT name, image FROM categories WHERE id=$a[category]") or sqlerr(__FILE____LINE__);
                
$a2 mysql_fetch_assoc($r2);
                
$cat "<img src=\"pic/$a2[image]\"  height='24' alt=\"$a2[name]\">";
                
$ishentai = ($a2["name"]=="Hentai" "&nbsp;<font color=red>(+18)</font> <img src='pic/buttons/uncensored.gif' />" "");
                
  
$res2 mysql_query("SELECT fansubbers.name as f_name, fansubbers.tag AS f_tag, fansubbers.id AS f_id FROM fansubbers 
LEFT JOIN torrents ON torrents.fansubber = fansubbers.id WHERE torrents.id =" 
$a["id"] . "")
or 
sqlerr();
$row2 mysql_fetch_assoc($res2);

$res3 mysql_query("SELECT estado.image AS est_image, estado.name AS est_name FROM estado LEFT JOIN torrents ON torrents.status = estado.id WHERE torrents.id = $id")
    or 
sqlerr();
$row3 mysql_fetch_assoc($res3);

if (
$a[status] == 1)
$est_proj = ("<img title='Projecto concluído' src=pic/concluido.gif>\n");
elseif (
$a[status] == 2)
$est_proj = ("<img title='Projecto em andamento' src=pic/em_andamento.gif>\n");
elseif (
$a[status] == 3)
$est_proj = ("<img title='Projecto parado' src=pic/parado.gif>\n");
elseif (
$a[status] == 4)
$est_proj = ("<img title='Projecto cancelado' src=pic/warned2.gif>\n");
elseif (
$a[status] == 5)
$est_proj = ("<img title='Projecto terminado' src=pic/terminado.gif>\n");
elseif (
$a[status] == 6)
$est_proj = ("<img title='Especiais apenas' src=pic/starb.gif>\n");
elseif (
$a[status] == 7)
$est_proj = ("<img title='Projecto com estado desconhecido' src=pic/desconhecido.gif>\n");
elseif (
$a[status] == 8)
$est_proj = ("<img title=src=pic/+.gif>\n");
else
$est_proj = ("$est_proj\n");
                
if ((
$a["name"]) == ($a["nameorig"]))
        
$dispname htmlspecialchars($a["nameorig"]);
        else
        
$dispname htmlspecialchars($a["nameorig"]) ."&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;"htmlspecialchars($a["name"]);

      
      
$data mysql_query("SELECT size * times_completed AS data FROM torrents WHERE id = '$a[id]'") or sqlerr(__FILE____LINE__); 
      
$b mysql_fetch_assoc($data);
      
$data mksize($b["data"]) . "";
      


$resbook mysql_query("SELECT bookmarks.id, bookmarks.torrentid, bookmarks.userid, bookmarks.local, bookmarks.visto FROM bookmarks LEFT JOIN torrents ON bookmarks.torrentid = torrents.id WHERE bookmarks.userid = $id AND torrents.id = $a[id] AND bookmarks.id = $a[bid]") or sqlerr();
$rowbook mysql_fetch_assoc($resbook);
{
{
if (
$rowbook["local"] =="--")
$marcalocal = ("");
elseif (
$rowbook["local"] =="Disco")
$marcalocal = ("<img src=pic/buttons/state_onhdd.gif border=0 title='Projecto " .$a["nameorig"]. " guardado em Disco'>\n"); 
elseif (
$rowbook["local"] =="CD/DVD")
$marcalocal = ("<img src=pic/buttons/state_oncd.gif border=0 title='Projecto " .$a["nameorig"]. " guardado em CD/DVD'>\n");
else
$marcalocal = ("\n");
}
{
if (
$rowbook["visto"] =="--")
$marcavisto = ("");
elseif (
$rowbook["visto"] =="completo")
$marcavisto = ("<img src=pic/buttons/seen.gif border=0 title='Projecto " .$a["nameorig"]. " visto na totalidade'>\n"); 
elseif (
$rowbook["visto"] =="parte")
$marcavisto = ("<img src=pic/buttons/seeing.gif border=0 title='Projecto " .$a["nameorig"]. " visto em parte'>\n"); 
elseif (
$rowbook["visto"] =="nunca")
$marcavisto = ("<img src=pic/buttons/seen_no.gif border=0 title='Projecto " .$a["nameorig"]. " nunca visto'>\n");
else
$marcavisto = ("\n");
}
}


      
//if (($CURUSER[id] == $a[userid]) || (get_user_class() >= UC_MODERATOR) || ($CURUSER[id] == $a[bookmarks]))
     //$torrents .= "<tr class=tableb><td style='padding: 3px' align=center><a href=delmark.php?id=$a[bid]><img src=pic/delbookmark.gif border=0 title='Remover dos marcados'></a><br><br><a class=\"index\" href=\"download.php/$a[id]/" . rawurlencode($a["filename"]) . "\"><img src=pic/download.gif border=0 alt='DOWNLOAD&nbsp;$a[name]'></a></td><td style='padding: 0px'>$cat</td><td><a href=details.php?id=" . $a["id"] . "&hit=1><b>" . htmlspecialchars($a["name"]) . "</b></a></td>" .
     
$torrents .= "<tr class=tableb>
     <td align=center><a class=altlink href=details.php?id=" 
$a["id"] . "&hit=1><img border='0' title='Ver detalhes do projecto: '"$a["nameorig"] . "'' src=pic/buttons/m_info.gif></a></td>
     <td align=center>&nbsp;&nbsp;&nbsp;<a class=altlink href=details.php?id=" 
$a["id"] . "&hit=1><b><font color=black>$dispname</font></b></a>&nbsp;&nbsp;$ishentai&nbsp;</td>
     <td align=center>
$marcalocal&nbsp;$marcavisto</td>
     <td align=center>
$cat</td>
     <td align=center><b>" 
$a["ano"] . "</b></td>
     <td align=center><b>" 
$a["epsl"] . " / " $a["epst"] . "</b></td>
     <td align=center>
$est_proj</td>
     <td align=center><b><a href=\"files.php?id=
$a[id]&amp;hit=1&amp;filelist=1\">" $a["numfiles"] . "</a> / " str_replace(" ""&nbsp;"mksize($a["size"])) . "</b></td>
     <td align=center><a href=\"fansubbersdetails.php?id="
$row2["f_id"] ."\" class=altlink><b><font color=black>[" $row2["f_tag"] . "]</font></b></a></td>

     </tr>\n"
;
  }
  
$torrents .= "</table>";
}
}
$ret1 mysql_query("SELECT username FROM users WHERE id=$id") or sqlerr(__FILE____LINE__);
$arr1 mysql_fetch_assoc($ret1);
$user "<b>$arr1[username]</b>";

print(
"<table width=690 border=0><h1><b>A lista do utilizador: $user</b></h1></table>\n");
if (!
$torrents)
print(
"<table align=center cellpadding=5><td align=center><b>empty</b><br></td></table>\n");

else if (
$count) {

$letter trim($_GET["letter"]);
if (
strlen($letter) > 1)
die;

if (
$letter == "" || strpos("abcdefghijklmnopqrstuvwxyz"$letter) === false)
$letter "";
$query "nameorig LIKE '$letter%'";
$q "letter=$letter";

  for (
$i 97$i 123; ++$i)
{

$l chr($i);
$L chr($i 32);
$lol "?id=$id";
if (
$l == $letter)
print(
"&nbsp;&nbsp;&nbsp;<font size=4><b>$L</b></font>\n");
else
print(
"&nbsp;&nbsp;&nbsp;<a href="$lol ."?letter=$l class=altlink><font color=#004E98 size=2><b>$L</b></font></a>\n");
}
if (
$letter == "" || strpos("abcdefghijklmnopqrstuvwxyz"$letter) === false)
print(
"&nbsp;&nbsp;&nbsp;&nbsp;<font size=4><b>Todas</b></font>\n");
else
print(
"&nbsp;&nbsp;&nbsp;&nbsp;<a href=minhalistapublica2.php?id=$id class=altlink><font color=#004E98 size=2><b>Todas</b></font></a>\n");
print(
"</p>\n");
    print(
"$torrents\n");
    if (
$letter == "" || strpos("abcdefghijklmnopqrstuvwxyz"$letter) === false)
    print(
"<p align=center><a href=#top class=altlink>Top</a></p>");
}

print(
"</table>\n");

stdfoot();

?>
you can check the page if you like, here:
http://db.revanime.net/minhalistapublica2.php?id=2

Bump: I changed this part
PHP Code:
$l chr($i);
$L chr($i 32);
$lol "?id=$id";
if (
$l == $letter)
print(
"&nbsp;&nbsp;&nbsp;<font size=4><b>$L</b></font>\n");
else
print(
"&nbsp;&nbsp;&nbsp;<a href="$lol ."?letter=$l 
to
PHP Code:
$l chr($i);
$L chr($i 32);
if (
$l == $letter)
print(
"&nbsp;&nbsp;&nbsp;<font size=4><b>$L</b></font>\n");
else
print(
"&nbsp;&nbsp;&nbsp;<a href=?id=$id&amp;letter=$l 
Now, when i click on some letter at the list, it changes the letter but bellow on the table, the result is the same as if it was on "all letters"

Bump: Don't bother with this.
The problem was in the main query but I already solved it.
Everything's working good now.

Here's the final file
[HIDE]
PHP Code:
<?
require "include/bittorrent.php";

    
$letter trim($_GET["letter"]);
  if (
strlen($letter) > 1)
    die;

  if (
$letter == "" || strpos("abcdefghijklmnopqrstuvwxyz"$letter) === false){
        
$query "";
    } else {
        
$query "AND torrents.nameorig LIKE '$letter%'";
    }
  
$q "letter=$letter";

 

stdhead("Lista de anime");
$id = (int)$_GET["id"];
$ret1 mysql_query("SELECT username FROM users WHERE id=$id") or sqlerr(__FILE____LINE__);
$arr1 mysql_fetch_assoc($ret1);
$user "<b>$arr1[username]</b>";
print(
"<table width=690 border=0><h1><b>A lista de anime do utilizador: $user</b></h1></table>\n");

for (
$i 97$i 123; ++$i)
{
$l chr($i);
$L chr($i 32);

if (
$l == $letter)
print(
"&nbsp;&nbsp;&nbsp;<font size=4><b>$L</b></font>\n");
else
print(
"&nbsp;&nbsp;&nbsp;<a href=?id=$id&amp;letter=$l class=altlink><font color=#004E98 size=2><b>$L</b></font></a>\n");
}
if (
$letter == "" || strpos("abcdefghijklmnopqrstuvwxyz"$letter) === false)
print(
"&nbsp;&nbsp;&nbsp;&nbsp;<font size=4><b>Todos</b></font>\n");
else
print(
"&nbsp;&nbsp;&nbsp;&nbsp;<a href=minhalistapublica.php?id=$id class=altlink><font color=#004E98 size=2><b>Todos</b></font></a>\n");
print(
"</p>\n");

$id = (int)$_GET["id"];
$resc mysql_query("SELECT COUNT(*) FROM bookmarks WHERE bookmarks.userid = $id AND (bookmarks.local = 'Disco' OR bookmarks.local = 'CD/DVD')") or die(mysql_error());
$rowc mysql_fetch_array($resc,MYSQL_NUM);
$count $rowc[0];

$order "torrents.nameorig ASC";
if (
$count)
{    
$res mysql_query("SELECT torrents.id, torrents.ano, torrents.epsl, torrents.epst, torrents.status, torrents.comments, torrents.numfiles, 
torrents.poster, torrents.miniposter, torrents.nameorig, torrents.name, torrents.size, torrents.category, torrents.filename, torrents.added, 
torrents.seeders, torrents.leechers, torrents.owner, bookmarks.id AS bid, bookmarks.torrentid, bookmarks.userid, bookmarks.local, 
bookmarks.visto FROM bookmarks,torrents WHERE bookmarks.userid = '
$id' AND 
torrents.id = bookmarks.torrentid AND (bookmarks.local = 'Disco' OR bookmarks.local = 'CD/DVD') " 
$query " ORDER BY $order $limit") or sqlerr();
if (
mysql_num_rows($res) > 0)
{
  
$torrents "<table class=main border=1 cellspacing=0 cellpadding=6 align=center>\n" .
    
"<td class=colhead align=center>+Info</td>
    <td class=colhead align=center>Anime</td>
    <td class=colhead align=center><img src=pic/buttons/revanidb_mylist.gif>&nbsp;&nbsp;<img src=pic/buttons/seen1.gif></td>
    <td class=colhead align=center>Tipo</td>
    <td class=colhead align=center>Ano</td>
    <td class=colhead align=center>Eps.</td>
    <td class=colhead align=center>Estado</td>
    <td class=colhead align=center>Ficheiros</td>
    <td class=colhead align=center>Fansub</td>    
</tr>"
;
  while (
$a mysql_fetch_array($res))
  {
            
$r2 mysql_query("SELECT name, image FROM categories WHERE id=$a[category]") or sqlerr(__FILE____LINE__);
                
$a2 mysql_fetch_assoc($r2);
                
$cat "<img src=\"pic/$a2[image]\"  height='24' alt=\"$a2[name]\">";
                
$ishentai = ($a2["name"]=="Hentai" "&nbsp;<font color=red>(+18)</font> <img src='pic/buttons/uncensored.gif' />" "");
                
  
$res2 mysql_query("SELECT fansubbers.name as f_name, fansubbers.tag AS f_tag, fansubbers.id AS f_id FROM fansubbers 
LEFT JOIN torrents ON torrents.fansubber = fansubbers.id WHERE torrents.id =" 
$a["id"] . "")
or 
sqlerr();
$row2 mysql_fetch_assoc($res2);

$res3 mysql_query("SELECT estado.image AS est_image, estado.name AS est_name FROM estado LEFT JOIN torrents ON torrents.status = estado.id WHERE torrents.id = $id")
    or 
sqlerr();
$row3 mysql_fetch_assoc($res3);

if (
$a[status] == 1)
$est_proj = ("<img title='Projecto concluído' src=pic/concluido.gif>\n");
elseif (
$a[status] == 2)
$est_proj = ("<img title='Projecto em andamento' src=pic/em_andamento.gif>\n");
elseif (
$a[status] == 3)
$est_proj = ("<img title='Projecto parado' src=pic/parado.gif>\n");
elseif (
$a[status] == 4)
$est_proj = ("<img title='Projecto cancelado' src=pic/warned2.gif>\n");
elseif (
$a[status] == 5)
$est_proj = ("<img title='Projecto terminado' src=pic/terminado.gif>\n");
elseif (
$a[status] == 6)
$est_proj = ("<img title='Especiais apenas' src=pic/starb.gif>\n");
elseif (
$a[status] == 7)
$est_proj = ("<img title='Projecto com estado desconhecido' src=pic/desconhecido.gif>\n");
elseif (
$a[status] == 8)
$est_proj = ("<img title=src=pic/+.gif>\n");
else
$est_proj = ("$est_proj\n");
                
if ((
$a["name"]) == ($a["nameorig"]))
        
$dispname htmlspecialchars($a["nameorig"]);
        else
        
$dispname htmlspecialchars($a["nameorig"]) ."&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;"htmlspecialchars($a["name"]);
  
      
$data mysql_query("SELECT size * times_completed AS data FROM torrents WHERE id = '$a[id]'") or sqlerr(__FILE____LINE__); 
      
$b mysql_fetch_assoc($data);
      
$data mksize($b["data"]) . "";      

$resbook mysql_query("SELECT bookmarks.id, bookmarks.torrentid, bookmarks.userid, bookmarks.local, bookmarks.visto 
FROM bookmarks LEFT JOIN torrents ON bookmarks.torrentid = torrents.id 
WHERE bookmarks.userid = 
$id AND torrents.id = $a[id] AND bookmarks.id = $a[bid]") or sqlerr();
$rowbook mysql_fetch_assoc($resbook);
{
{
if (
$rowbook["local"] =="--")
$marcalocal = ("");
elseif (
$rowbook["local"] =="Disco")
$marcalocal = ("<img src=pic/buttons/state_onhdd.gif border=0 title='Projecto " .$a["nameorig"]. " guardado em Disco'>\n"); 
elseif (
$rowbook["local"] =="CD/DVD")
$marcalocal = ("<img src=pic/buttons/state_oncd.gif border=0 title='Projecto " .$a["nameorig"]. " guardado em CD/DVD'>\n");
else
$marcalocal = ("\n");
}
{
if (
$rowbook["visto"] =="--")
$marcavisto = ("");
elseif (
$rowbook["visto"] =="completo")
$marcavisto = ("<img src=pic/buttons/seen.gif border=0 title='Projecto " .$a["nameorig"]. " visto na totalidade'>\n"); 
elseif (
$rowbook["visto"] =="parte")
$marcavisto = ("<img src=pic/buttons/seeing.gif border=0 title='Projecto " .$a["nameorig"]. " visto em parte'>\n"); 
elseif (
$rowbook["visto"] =="nunca")
$marcavisto = ("<img src=pic/buttons/seen_no.gif border=0 title='Projecto " .$a["nameorig"]. " nunca visto'>\n");
else
$marcavisto = ("\n");
}
}

  
    
$torrents .= "<tr class=tableb>
     <td align=center><a class=altlink href=details.php?id=" 
$a["id"] . "&hit=1><img border='0' title='Ver detalhes do projecto: "$a["nameorig"] . "' src=pic/buttons/m_info.gif></a></td>
     <td align=center>&nbsp;&nbsp;&nbsp;<a class=altlink href=details.php?id=" 
$a["id"] . "&hit=1><b><font color=black>$dispname</font></b></a>&nbsp;&nbsp;$ishentai&nbsp;</td>
     <td align=center>
$marcalocal&nbsp;$marcavisto</td>
     <td align=center>
$cat</td>
     <td align=center><b>" 
$a["ano"] . "</b></td>
     <td align=center><b>" 
$a["epsl"] . " / " $a["epst"] . "</b></td>
     <td align=center>
$est_proj</td>
     <td align=center><b><a href=\"files.php?id=
$a[id]&amp;hit=1&amp;filelist=1\">" $a["numfiles"] . "</a> / " str_replace(" ""&nbsp;"mksize($a["size"])) . "</b></td>
     <td align=center><a href=\"fansubbersdetails.php?id="
$row2["f_id"] ."\" class=altlink><b><font color=black>[" $row2["f_tag"] . "]</font></b></a></td>
     </tr>\n"
;
  }
  
$torrents .= "</table>";
}
}

#Início do print

if (!$torrents)
print(
"<table align=center cellpadding=5><td align=center><b>Sem entradas</b><br></td></table>\n");
else if (
$count) {
  if (
strlen($letter) > 1)
    die;
  if (
$letter == "" || strpos("abcdefghijklmnopqrstuvwxyz"$letter) === false)
    
$letter "";
  
$query "torrents.nameorig LIKE '$letter%'";
  
$q "letter=$letter";
  
    print(
"$torrents\n");
    print(
"<p align=center><a href=#top class=altlink>Voltar ao topo da lista</a></p>");
}
print(
"</table>\n");
stdfoot();
?>
[/HIDE]

Last edited by ndbj; 19th September 2013 at 15:11. Reason: add an url to people visit and check the problem
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 13:14. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.