Tcmaker Posted January 7, 2010 Posted January 7, 2010 My forum topics is not showing i think its to do with this code can someone give me a fix please function viewtopic() { global $ir, $c, $userid, $h, $bbc, $db; $precache=array(); $q=mysql_query("SELECT * FROM forum_topics WHERE ft_id={$_GET['viewtopic']}",$c); $topic=mysql_fetch_array($q); $q2=mysql_query("SELECT * FROM forum_forums WHERE ff_id={$topic['ft_forum_id']}",$c); $forum=mysql_fetch_array($q2); if(($forum['ff_auth']=='gang' AND $ir['gang'] != $forum['ff_owner'] and $ir["user_level"] < 2) OR ($forum['ff_auth'] == 'staff' AND $ir['user_level'] < 2)) { print "You have no permission to view this forum. > [url='forums.php']Back[/url]"; $h->endpage(); exit; } print "<big>[url='forums.php']Forums Home[/url] >> [url='forums.php?viewforum={$forum[']{$forum['ff_name']}[/url] >> [url='forums.php?viewtopic={$_GET[']{$topic['ft_name']}[/url]</big> "; $posts_per_page=20; $posts_topic=$topic['ft_posts']; $pages=ceil($posts_topic/$posts_per_page); $st= ($_GET['st']) ? $_GET['st'] : 0; if($_GET['lastpost']) { $st=($pages-1)*20; } $pst=-20; print "Pages: "; for($i=1;$i<=$pages;$i++) { $pst+=20; print "<a href='forums.php?viewtopic={$topic['ft_id']}&st=$pst'>"; if($pst == $st) { print "[b]"; } print $i; if($pst == $st) { print "[/b]"; } print "</a>"; if($i % 25 == 0) { print " "; } } print " "; if($ir['user_level'] == 2 || $ir['user_level'] == 4) { print " <form action='forums.php?act=move&topic={$_GET['viewtopic']}' method='post'>[b]Move topic to:[/b] ".forum_dropdown($c, 'forum', -1)."<input type='submit' value='Move' /></form> [url='forums.php?act=pin&topic={$_GET['][img=sticky.jpg][/url] | [url='forums.php?act=lock&topic={$_GET['][img=lock.jpg][/url] | [url='forums.php?act=deletopic&topic={$_GET['][img=delete.gif][/url] "; } print " <table style='border-style:solid;border-width:1px;border-color:#303030;' width='100%' cellpadding='5'>"; $q3=mysql_query("SELECT * FROM forum_posts WHERE fp_topic_id={$topic['ft_id']} ORDER BY fp_time ASC LIMIT $st, 20",$c); $no=$st; while($r=mysql_fetch_array($q3)) { $qlink="[[url='forums.php?act=quote&viewtopic={$_GET[']Quote Post[/url]]"; if($ir['user_level'] > 1 || $ir['userid']==$r['fp_poster_id']) { $elink="[[url='forums.php?act=edit&post={$r[']Edit Post[/url]]"; } else { $elink=""; } $no++; if($ir['user_level'] != 1) { $slink="[[url='forumsig.php?ID={$r[']Delete Sig[/url]]"; } if($no > 1 && $ir['user_level'] != 1) { $dlink="[[url='forums.php?act=delepost&post={$r[']Delete Post[/url]]"; } else { $dlink=""; } $t=date('F j Y, g:i:s a',$r['fp_time']); if($r['fp_edit_count'] > 0) { $edittext="\n [i]Last edited by [url='viewuser.php?u={$r[']{$r['fp_editor_name']}[/url] at ".date('F j Y, g:i:s a',$r['fp_editor_time']).", edited [b]{$r['fp_edit_count']}[/b] times in total.[/i]"; } else { $edittext=""; } if(!$precache[$r['fp_poster_id']]['userid']) { $membq=mysql_query("SELECT * FROM users WHERE userid={$r['fp_poster_id']}",$c); $memb=mysql_fetch_array($membq); $precache[$memb['userid']]=$memb; } else { $memb=$precache[$r['fp_poster_id']]; } $rank=forums_rank($memb['posts']); $msg="{$memb['forums_avatar']}"; $msg=strip_tags($msg); if($memb['forums_avatar']) { $av="[img=$msg]"; } else { $av="[img=noav.gif]"; } if(!$memb['forums_signature']) { $memb['forums_signature']="No Signature"; } else {$memb['forums_signature']=$bbc->bbcode_parse($memb['forums_signature']); } $r['fp_text']=$bbc->bbcode_parse($r['fp_text']); print "<tr bgcolor='#404040'> <th align='center' width=20%>Post #{$no}</th> <th align='center'>Subject: {$r['fp_subject']} $t $qlink$slink$elink$dlink</th> </tr> <tr bgcolor='#404040'>"; $mycolor=""; if($memb['user_level'] == 2) { $mycolor="blue"; } if($memb['user_level'] == 1 && $memb['donatordays'] == 0) { $mycolor="gray"; } if($memb['user_level'] == 1 && $memb['donatordays'] > 0) { $mycolor="lightblue"; } if($memb['user_level'] == 4) { $mycolor="purple"; } if($memb['user_level'] == 3) { $mycolor="green"; } if($memb['user_level'] == 5) { $mycolor="orange"; } print"<td valign=top><center>[url='viewuser.php?u={$r[']<font color='$mycolor'>{$r['fp_poster_name']}</font>[/url] [{$r['fp_poster_id']}] Level: {$memb['level']}</br>Posts: {$memb['posts']}</br></br></br> $av </br></br> Rank:</br><font color=red>$rank</font></center></td> <td valign=top>{$r['fp_text']} {$edittext} ------------------- {$memb['forums_signature']}</td> </tr>"; } print "</table>"; $pst=-20; print "Pages: "; for($i=1;$i<=$pages;$i++) { $pst+=20; print "<a href='forums.php?viewtopic={$topic['ft_id']}&st=$pst'>"; if($pst == $st) { print "[b]"; } print $i; if($pst == $st) { print "[/b]"; } print "</a>"; if($i % 25 == 0) { print " "; } } if(!$topic['ft_locked']) { print <<<EOF [b]Post a reply to this topic:[/b] <form action='forums.php?reply={$topic['ft_id']}' method='post'> <table style='border-style:solid;border-width:1px;border-color:#303030;' width='80%' cellpadding='5'> <tr> <td align='right' bgcolor='#606060'>Subject:</td> <td align='left' bgcolor='#404040'><input type='text' name='fp_subject' /></td> </tr> <tr> <td align='right' bgcolor='#606060'>Post:</td> <td align='left' bgcolor='#404040'><textarea rows='7' cols='40' name='fp_text'></textarea></td> </tr> <tr bgcolor='#404040'> <th colspan='2' bgcolor='#404040'><input type='submit' value='Post Reply'></th> </tr> </table> </form> EOF; } else { print " [i]This topic has been locked, you cannot reply to it.[/i]"; } } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.