Viewtpc error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Viewtpc error

    Who can help me please my viewtpc show only the first two pages then after that it show empty pages it dnt show the text on the other pages
    Code:
    //////////////////////////////////View Topic///////////////////
    else if($action=="viewtpc"){
     $pstyle = gettheme($sid);
        echo xhtmlhead("$stitle",$pstyle);
    getalert($sid);
    $tid = $_GET["tid"];
    $go = $_GET["go"];
    $tfid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$tid."'"));
    $fname = getfname($tfid[0]);
    if (isforumblocked($uid)){
    			boxstart("Error!");
    		echo "<img src=\"notok.gif\"/>";
    echo "Your forum access has been blocked by a moderator!!!<br/><br/>";
    echo "<a href=\"index.php?action=main&amp;sid=$sid\">Main Menu</a>";
    
    echo "</font></body></html>";
    exit();
    }
    if(!canaccess($uid, $tfid[0])){
    			boxstart("Error!");
    		echo "<img src=\"notok.gif\"/>";
    echo "This post belongs to $fname forum which is not available to you presently. To read this post, join $fname group.<br/><br/>";
    echo "<a href=\"index.php?action=main&amp;sid=$sid\">Main Menu</a>";
    echo "</font></body></html>";
    exit();
    }
    if($go!="") {
            $page=getpage_go($go,$tid,$sid);
    }
    boxstart("Topic");
    $tinfo = mysql_fetch_array(mysql_query("SELECT name, text, authorid, crdate, views, fid, pollid from ibwf_topics WHERE id='".$tid."'"));
    $tnm = htmlspecialchars($tinfo[0]);
    $namewa = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_forums WHERE id = $tinfo[5]"));
    $namewa1 = htmlspecialchars($namewa[0]);
    $rampagetime = time() + (addhours());
    addonline($uid,"Reading post <i>$tnm</i> in $fname forum","index.php?action=$action&amp;tid=$tid");
    boxstart("$tnm");
    $vws = $tinfo[4]+1;
    $num_pages = getnumpages($tid, $sid);
    echo "Subject: $tnm<br/>Viewed: $vws times<br/>Topic no.: $tid<br/>";
    $pagewa = 1;
    while ($pagewa<=$num_pages)
    {
            echo "Page [<a href=\"index.php?action=viewtpc&amp;page=$pagewa&amp;sid=$sid&amp;tid=$tid\">$pagewa</a>]";
            $pagewa = $pagewa+1;
    };
    if($page==""||$page<1) {
            $page=1;
    }
    $posts_per_page = getppp($uid);
    if($page>$num_pages) {
    $page=$num_pages;
    }
    $limit_start = $posts_per_page *($page-1);
    $rpls = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$tid."'"));
    ///fm here
    if($page==1){
    mysql_query("UPDATE ibwf_topics SET views='".$vws."' WHERE  id='".$tid."'");
    $ttext = mysql_fetch_array(mysql_query("SELECT authorid, text, crdate, pollid FROM ibwf_topics WHERE id='".$tid."'"));
    $unick = getnick_uid($ttext[0]);
    if($showavatar[0]=="1")
    {
    $avlink = getavatar($item[2]);
    if ($avlink!=""){
    echo "<img src=\"$avlink\" height=\"25\" width=\"25\" alt=\"avatar\"/>";
    }else{
    echo "<img src=\"/images/nopic.jpg\" height=\"25\" width=\"25\" alt=\"avatar\"/>";
    }
    }
    if(isonline($ttext[0])){
    $iml = "<img src=\"images/onl.gif\" alt=\"+\"/>";
    }else{
    $iml = "<img src=\"images/ofl.gif\" alt=\"-\"/>";
    }
    if(isadmin($ttext[0]))
    {$usl = "$iml<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$ttext[0]\"><font color='red'>$unick</font></a>";}
    else if(isadmin($ttext[0]))
    {$usl = "$iml<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$ttext[0]\"><font color='lightgreen'>$unick</font></a>";}
    else if(ismod($ttext[0]))
    {$usl = "$iml<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$ttext[0]\"><font color='blue'>$unick</font></a>";}
    else if(isbanned($ttext[0]))
    {$usl = "$iml<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$ttext[0]\"><strike>$unick</strike></a>";}
    else
    {$usl = "$iml<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$ttext[0]\">$unick</a>";}
    $topt = "<a href=\"index.php?action=tpcopt&amp;sid=$sid&amp;tid=$tid\">[Options] </a>";
    $rep = "<a href=\"index.php?action=addrep&amp;sid=$sid&amp;tid=$tid\">[Rate]</a>";
    $pst = parsemsg($ttext[1],$sid);
    echo "<br/>Post from $usl: $topt $rep<br/>";
    $rampagetime = $ttext[2] + (addhours());
    $dtot = date("d/m/Y h:i:s A",$rampagetime);
    echo $dtot."<br/>";
    echo "<br/>$pst<br/>";
    if($ttext[3]>0){
    echo "<a href=\"index.php?action=viewtpl&amp;sid=$sid&amp;who=$tid\">POLL</a><br/>";
    }
    }
    if($page>1){
    $limit_start--;
    }
    $sql = "SELECT id, text, uid, dtpost FROM ibwf_posts WHERE tid='".$tid."' ORDER BY dtpost LIMIT $limit_start, $posts_per_page";
    $posts = mysql_query($sql);
    while($post = mysql_fetch_array($posts)){
    $unick = getnick_uid($post[2]);
    if(isonline($post[2])){
    $iml = "<img src=\"images/onl.gif\" alt=\"+\"/>";
    }else{
    $iml = "<img src=\"images/ofl.gif\" alt=\"-\"/>";
    }
    if(isadmin($post[2]))
    {$usl = "$iml<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$post[2]\"><font color='red'>$unick</font></a>";}
    else if(isvip($post[2]))
    {$usl = "$iml<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$post[2]\"><font color='lightgreen'>$unick</font></a>";}
    else if(ismod($post[2]))
    {$usl = "$iml<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$post[2]\"><font color='blue'>$unick</font></a>";}
    else if(isbanned($post[2]))
    {$usl = "$iml<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$post[2])\"><strike>$unick</strike></a>";}
    else
    {$usl = "$iml<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$post[2]\">$unick</a>";}
    $pst = parsemsg($post[1], $sid);
    $topt = "<a href=\"index.php?action=pstopt&amp;sid=$sid&amp;pid=$post[0]&amp;page=$page&amp;fid=$tinfo[5]\">[Options]</a>";
    echo "<br/>$usl: $topt<br/>";
    $rampagetime = $post[3] + (addhours());
    $dtot = date("d/m/Y h:i:s A",$rampagetime);
    echo $dtot."<br/>";
    echo "$pst<br/>";
    }
    
    echo "<center>";
    if($page<$num_pages){
    $npage = $page+1;
    echo "<a href=\"index.php?action=viewtpc&amp;page=$npage&amp;sid=$sid&amp;tid=$tid\">Next</a><br/>";
    }
    if($page>1){
    $ppage = $page-1;
    echo "<a href=\"index.php?action=viewtpc&amp;page=$ppage&amp;sid=$sid&amp;tid=$tid\">&#171;Previous</a>";
    }
    echo "Add reply:<br/><form action=\"genproc.php?action=post&amp;sid=$sid\" method=\"post\"><textarea id=\"inputText\" name=\"reptxt\"></textarea><br/>";
    echo "
    <input type=\"hidden\" name=\"tid\" value=\"$tid\"/>
    <input type=\"hidden\" name=\"qut\" value=\"\"/>
    <input id=\"inputButton\" type=\"submit\" value=\"Send\"/>
    </form></center>";
    echo "<p align=\"center\">Page $page of $num_pages<br/>";
    $fid = $tinfo[5];
    $fname = getfname($fid);
    echo "<a href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$fid\">Back to $fname Forum</a><br/><br/></p>";
    boxend();
    }
Working...
X