Hey friends , in every forum i found that when a thread created, has more than 5 replies the 6th reply goes on other page as a result the person visiting the last page doesnt know what the topic is , he only gets to see the replies until he visits the first page , help me out with this , i want to show thread title on all pages at the top irrespective of the pagenumber of replies ,help me modify this
PHP Code:
/////////////////////////////////View Topic///////////////////
else if($action=="viewtpc"){
gettimebar($sid);
getnewmsg($sid);
getalert($sid);
$tid = $_GET["tid"];
$go = $_GET["go"];
$seer = getuid_sid($sid);
$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&sid=$sid\">Main Menu</a>";
boxend();
echo "</body></html>";
exit();
}
if (inasylum($uid)){
boxstart("Error!");
echo "<img src=\"notok.gif\"/>";
echo "<center>You have been put into <i>The Youngbuzz PagalKhana</i>! Hence your Forum access has been blocked!<br/>Get Well Soon!<br/><br/>";
echo "<a href=\"index.php?action=main&sid=$sid\">Main Menu</a></center>";
boxend();
echo "</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 club.<br/><br/>";
echo "<a href=\"index.php?action=main&sid=$sid\">Main Menu</a>";
echo "</body></html>";
exit();
}
if($go!="") {
$page=getpage_go($go,$tid,$sid);
}
$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]);
$indiatime = time() + (addhours());
addonline($uid,"Reading post <i>$tnm</i> in $fname forum","index.php?action=$action&tid=$tid");
boxstart("$tnm");
$vws = $tinfo[4]+1;
$num_pages = getnumpages($tid, $sid);
echo "Subject: $tnm<br/>Viewed: $vws times<br/>Topic # $tid<br/>Page # $page of $num_pages<br/>Pages:";
$pagewa = 1;
while ($pagewa<=$num_pages)
{
echo "[<a href=\"index.php?action=viewtpc&page=$pagewa&sid=$sid&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."'");
$res=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topseen WHERE tid='".$tid."' AND uid='".$seer."'"));
if($res[0]>0){
mysql_query("UPDATE ibwf_topseen SET time=$indiatime WHERE tid='".$tid."' AND uid='".$seer."'");
}
else if($res[0]==0){
mysql_query("INSERT INTO ibwf_topseen VALUES(NULL, '".$tid."', '".$seer."', $indiatime)");
}
$ttext = mysql_fetch_array(mysql_query("SELECT authorid, text, crdate, pollid FROM ibwf_topics WHERE id='".$tid."'"));
$unick = getnick_uid($ttext[0]);
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&sid=$sid&who=$ttext[0]\"><font color='red'><big><b>$unick</b></big></font></a>";}
else if(isvip($ttext[0]))
{$usl = "$iml<a href=\"index.php?action=viewuser&sid=$sid&who=$ttext[0]\"><font color='lightgreen'>$unick</font></a>";}
else if(ismod($ttext[0]))
{$usl = "$iml<a href=\"index.php?action=viewuser&sid=$sid&who=$ttext[0]\"><font color='blue'>$unick</font></a>";}
else if(isheadadd($ttext[0]))
{$usl = "$iml<a href=\"index.php?action=viewuser&sid=$sid&who=$ttext[0]\"><font color='black'><b>$unick</b></font></a>";}
else if(isbanned($ttext[0]))
{$usl = "$iml<a href=\"index.php?action=viewuser&sid=$sid&who=$ttext[0]\"><strike>$unick</strike></a>";}
else
{$usl = "$iml<a href=\"index.php?action=viewuser&sid=$sid&who=$ttext[0]\">$unick</a>";}
$topt = "[<a href=\"index.php?action=tpcopt&sid=$sid&tid=$tid\">+</a>]";
//$rep = "<a href=\"index.php?action=addrep&sid=$sid&tid=$tid\">[R]</a>";
$thnk = "[<a href=\"genproc.php?action=thanks&sid=$sid&tid=$tid\">T</a>]";
$pst = parsemsg($ttext[1],$sid);
echo "<br/>Post from $usl: $topt $thnk<br/>";
$indiatime = $ttext[2] + (addhours());
$dtot = date("d/m/Y h:i:s A",$indiatime);
echo $dtot."<br/>";
echo "<br/>$pst<br/><br/>";
if($ttext[3]>0){
echo "<a href=\"index.php?action=viewtpl&sid=$sid&who=$tid\">POLL</a><br/>";
}
}
if($page>1){
$limit_start--;
}
$sql = "SELECT id, text, uid, dtpost, quote 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&sid=$sid&who=$post[2]\"><font color='red'><big><b>$unick</b></big></font></a>";}
else if(isvip($post[2]))
{$usl = "$iml<a href=\"index.php?action=viewuser&sid=$sid&who=$post[2]\"><font color='lightgreen'>$unick</font></a>";}
else if(ismod($post[2]))
{$usl = "$iml<a href=\"index.php?action=viewuser&sid=$sid&who=$post[2]\"><font color='blue'>$unick</font></a>";}
else if(isheadadd($post[2]))
{$usl = "$iml<a href=\"index.php?action=viewuser&sid=$sid&who=$post[2]\"><b><font color='black'>$unick</font></b></a>";}
else if(isbanned($post[2]))
{$usl = "$iml<a href=\"index.php?action=viewuser&sid=$sid&who=$post[2])\"><strike>$unick</strike></a>";}
else
{$usl = "$iml<a href=\"index.php?action=viewuser&sid=$sid&who=$post[2]\">$unick</a>";}
$pst = parsemsg($post[1], $sid);
$quo = parsemsg($post[4], $sid);
$topt = "[<a href=\"index.php?action=pstopt&sid=$sid&pid=$post[0]&page=$page&fid=$tinfo[5]\">+</a>]";
$quop = "<a href=\"index.php?action=quote&sid=$sid&pid=$post[0]&tid=$tid\">[Q]</a>";
echo "<br/>Reply from $usl: $topt $quop<br/>";
$indiantime = $post[3] + (addhours());
$dtot = date("d/m/Y h:i:s A",$indiantime);
echo $dtot."<br/>";
if($quo==NULL)
{echo "";}
else
{echo "<br/>----<br/>";
echo "$quo";
echo "<br/>----<br/>";}
echo "<br/>$pst<br/>";
}
boxend();
echo "<p style=\"text-align: center\">";
if($page<$num_pages){
$npage = $page+1;
echo "<a href=\"index.php?action=viewtpc&page=$npage&sid=$sid&tid=$tid\">Next»</a><br/>";
}
if($page>1){
$ppage = $page-1;
echo "<a href=\"index.php?action=viewtpc&page=$ppage&sid=$sid&tid=$tid\">«Previous</a>";
}
echo "<br/>Add reply:<br/><form align=\"center\" action=\"genproc.php?action=post&sid=$sid\" method=\"post\"><textarea class=\"inputText\" name=\"reptxt\"></textarea><br/>";
echo "
<input type=\"hidden\" name=\"tid\" value=\"$tid\"/>
<input type=\"hidden\" name=\"qut\" value=\"\"/>
<input class=\"inputButton\" name=\"pre\" type=\"submit\" value=\"Preview\"/>
<input class=\"inputButton\" name=\"post\" type=\"submit\" value=\"Post\"/>
</form></p>";
echo "<p style=\"text-align: center\">Page $page of $num_pages<br/>";
$fid = $tinfo[5];
$fname = getfname($fid);
echo "<a href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">Back To $fname Forum</a><br/><br/></p>";
getfooter($sid);
}
Comment