Jump to content

Sticky Forum Help Coding


avatar.alex

Recommended Posts

ok i need help with this one....I would like the locked topics of the forum to stay at the top kinda working like a sticky and I need help with coding a sticky.php file but heres the code to the forum.php...I am trying to create

<?php
session_start();
include "../admin/connect.php";
include "../header.php";
print "<link rel='stylesheet' href='../style.css' type='text/css'>";
$blogadmin=$_SESSION['blogadmin'];
$getadmin="SELECT * from bl_admin where username='$blogadmin'";
$getadmin2=mysql_query($getadmin) or die("Cannot get admin");
$getadmin3=mysql_fetch_array($getadmin2);
print "<center>";
print "<table width=90%><tr><td>";
print "<A href='index.php'>Forum Main</a>-";
if(isset($_SESSION['blogadmin']))
{
  print "Welcome $blogadmin";
}
else 
{
  print "<A href='../index.php'>Login</a>";
}
if(!isset($_GET['start']))
{
  $start=0;
}
else
{
  $start=$_GET['start'];
}
//code from new/old post identification
$thedate=date("U");
$checktime=$thedate-200;
$uprecords="Update bl_admin set lasttime='$thedate' where adminid='$getadmin3[adminid]'";
mysql_query($uprecords) or die("Could not update records");
if($getuser3[tsgone]<$checktime)
{
  $updatetime="Update bl_admin set tsgone='$thedate', oldtime='$getadmin3[tsgone]' where adminid='$getadmin3[adminid]'";
  mysql_query($updatetime) or die("Could not update time");
}

//now select topics



$ID=$_GET['ID'];
$gettopics="SELECT * FROM bl_forumposts a, bl_admin b where b.adminid=a.posterid and a.forumid='$ID' and a.threadid='0' order by a.thetime DESC limit $start,20";
$gettopics2=mysql_query($gettopics) or die("Could not get topics");
print "</td></tr></table><br><br></center>";
print "<center><table border='0' width=95%><tr><td>";
print "<A href='newpost.php?forumID=$ID'>New Post</a></td></tr></table><br>";
print "<table width=95% border='0'>";
print "<tr class='headline'><td colspan='2'><b>Topic</b></td><td><b>Topic Starter</b></td><td><b>Replies</b></td><td>Views</td><td>Last post</td></tr>";
while($gettopics3=mysql_fetch_array($gettopics2))
{
  $gettopics3[title]=strip_tags($gettopics3[title]); 
  print "<tr class='mainrow'><td width=3%>";
  if($gettopics3['islocked']==1)
  {
     print "<img src='../images/locked.gif' border='0'>";
  }
  else
  {
    if($gettopics3['thetime']>$getadmin3['oldtime'])
    {
      print "<img src='../images/yesnewposts.gif' border='0'>";
    }
    else
    {
      print "<img src='../images/topic.gif' border='0'>";
    }
  }
  print "</td><td width=35%><A href='message.php?forumID=$ID&ID=$gettopics3[postid]'>$gettopics3[title]</a></td><td width=15%>$gettopics3[username]</td><td width=8%>$gettopics3[numreplied]</td><td width=8%>$gettopics3[numviews]</td><td>$gettopics3[posttime]<br>Last Post by:<b>$gettopics3[lastposter]</b></td></tr>";

}
print "</table>";
print "<center>";
$order="SELECT COUNT(*) FROM bl_forumposts where forumid='$ID' and threadid='0'";
   $order2=mysql_query($order) or die("2");
   $d=0;
   $f=0;
   $g=1;
   $order3=mysql_result($order2,0);
   $prev=$start-15;
   $next=$start+15;
   if($start>=15)
   {
     print "<A href='forum.php?ID=$ID'>First</a>&nbsp  ";
     print "<A href='forum.php?ID=$ID&start=$prev'><<</a> ";
   }
   while($f<$order3)
   {
     if($f%15==0)
       {
         if($f>=$start-3*15&&$f<=$start+7*15)
         {
           print "<A href='forum.php?ID=$ID&start=$d'><b>$g</b></a> ";
           $g++;
         }
       }
     $d=$d+1;
     $f++;
   }
   if($start<$order3-15)
   {
     print " <A href='forum.php?ID=$ID&start=$next'>>></a>   ";
     $last=$order3-$numrepliesperpage;
     print "<A href='forum.php?ID=$ID&start=$last'>Last</a>";
   }
print "</center><br><br>";
print "<center><font size='1'>Powered by © <A href='http://www.chipmunk-scripts.com'>Chipmunk Blogger</a></font></center>";

?>

 

Link to comment
https://forums.phpfreaks.com/topic/50180-sticky-forum-help-coding/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.