139 lines
5.0 KiB
PHP
139 lines
5.0 KiB
PHP
<?php
|
|
// function cmp ($a, $b) {
|
|
// return ($b[date] - $a[date]);
|
|
// }
|
|
require("function.php");
|
|
require("layout.php");
|
|
$forums=mysqli_fetch_array(mysqli_query($con,"SELECT * FROM forums WHERE id = $_GET[id]"));
|
|
$threads=mysqli_query($con,"SELECT * FROM threads WHERE forum = $_GET[id] ORDER BY lastpostdate DESC") or die(mysqli_error());
|
|
if($loguserid){
|
|
$users=mysqli_fetch_array(mysqli_query($con,"SELECT * FROM users WHERE id = $loguserid"));
|
|
mysqli_query($con,"UPDATE users SET lastforum = $_GET[id] WHERE id = $loguserid");
|
|
}
|
|
else {
|
|
$users = null;
|
|
}
|
|
$ouser=mysqli_query($con,"SELECT * FROM users WHERE lastforum=$_GET[id] ORDER BY 'name'");
|
|
$usercount=0;
|
|
$numonline=0;
|
|
$onlineusers="";
|
|
while ($row=mysqli_fetch_array($ouser)) {
|
|
$usercount++;
|
|
$lastusername=$row['name'];
|
|
$lastuserid=$row['id'];
|
|
if ((time()-$row['lastactivity'])<300) {
|
|
$numonline++;
|
|
if ($numonline>1) {
|
|
$onlineusers.=", ";
|
|
}
|
|
$onlineusers.="<a href=profile.php?id=$row[id]>".$row['name']."</a>";
|
|
}
|
|
}
|
|
print $header;
|
|
print "</table></td></table>
|
|
<table border=0 bgcolor=$tableborder width=$tablewidth align=center cellpadding=0 cellspacing=0>
|
|
<td>
|
|
<table border=0 cellpadding=2 cellspacing=1 width=100% bgcolor=$tableborder>
|
|
$tccell1 $smallfont$numonline users currently in $forums[title]: $onlineusers
|
|
</table></td></table>
|
|
";
|
|
|
|
|
|
|
|
|
|
// $postread=readpostread();
|
|
if ($logpassword!="" and $_GET['id']>-1) {
|
|
$headlinks.=" | </a href=index.php?action=markforumread&forumid=$_GET[id]><s>Mark forum read</s></a>";
|
|
$header=makeheader($header1,$headlinks,$header2);
|
|
}
|
|
/*
|
|
$ppp=20;
|
|
if ($logpassword!="") {
|
|
$ppp=$users['threadsperpage'];
|
|
if ($ppp==0) { $ppp=20; }
|
|
}
|
|
*/
|
|
print "<br><table border=0 width=100%><td align=left>$fonttag<a href=index.php>$boardname</a> - ".$forums['title']."</td><td align=right>$smallfont";
|
|
if ($_GET[id]>-1) {
|
|
print "<a href=newthread.php?id=$_GET[id]>New Thread</a>";
|
|
}
|
|
print "</td></table>
|
|
<table border=0 bgcolor=$tableborder width=$tablewidth align=center cellpadding=0 cellspacing=0>
|
|
<td>
|
|
<table border=0 cellpadding=2 cellspacing=1 width=100% bgcolor=$tableborder>
|
|
";
|
|
$tccellha="<td bgcolor=$tableheadbg";
|
|
$tccellhb="><center>$fonthead";
|
|
$threadcount=0;
|
|
if (!$loguserid and $forums[minpower]>0){
|
|
print "$tccell1 Couldn't enter the forum. Either you don't have access to this restricted forum, or you are not logged in. <br>Click <a href=index.php>here</a> to return to the board.";
|
|
die(' ');
|
|
}
|
|
|
|
//Old powerlevel code
|
|
/*
|
|
if ($loguserid){
|
|
if ($forums['minpower']>$users['powerlevel']) {
|
|
print "$tccell1 Couldn't enter the forum. Either you don't have access to this restricted forum, or you are not logged in. <br>Click <a href=index.php>here</a> to return to the board.";
|
|
die(' ');
|
|
}
|
|
}
|
|
*/
|
|
|
|
print "
|
|
$tccellh"." </td>
|
|
$tccellha colspan=2$tccellhb"."Thread</td>
|
|
$tccellh"."Started by</td>
|
|
$tccellha width=60$tccellhb"."Replies</td>
|
|
$tccellha width=60$tccellhb"."Views</td>
|
|
$tccellha width=150$tccellhb"."Last post</td><tr>
|
|
|
|
";
|
|
|
|
while($row = mysqli_fetch_array($threads)){
|
|
$luser=mysqli_fetch_array(mysqli_query($con,"SELECT threads.forum,posts.id,posts.date,users.id,users.name,users.sex FROM threads INNER JOIN posts ON posts.thread=$row[id] AND threads.forum=$_GET[id] INNER JOIN users ON posts.user=users.id ORDER BY date DESC"));
|
|
$cuser=mysqli_fetch_array(mysqli_query($con,"SELECT threads.forum,posts.id,posts.date,users.id,users.name,users.sex FROM threads INNER JOIN posts ON posts.thread=$row[id] AND threads.forum=$_GET[id] INNER JOIN users ON posts.user=users.id ORDER BY date"));
|
|
$numreplies=mysqli_num_rows(mysqli_query($con,"SELECT threads.forum,threads.id,posts.thread FROM threads INNER JOIN posts ON posts.thread=threads.id AND threads.id=$row[id]"));
|
|
if ($numreplies){
|
|
$numreplies--;
|
|
}
|
|
|
|
if ($cuser['sex']==0) { $cnamecolor="color=$malecolor"; }
|
|
if ($cuser['sex']==1) { $cnamecolor="color=$femalecolor"; }
|
|
if ($cuser['sex']==2) { $cnamecolor="face=$font size=-1"; }
|
|
|
|
if ($luser['sex']==0) { $lnamecolor="color=$malecolor"; }
|
|
if ($luser['sex']==1) { $lnamecolor="color=$femalecolor"; }
|
|
if ($luser['sex']==2) { $lnamecolor="face=$font size=-1"; }
|
|
|
|
|
|
if ($row['icon']) { $rowicon="<img src=$row[icon]></td>"; }
|
|
|
|
|
|
print "$tccell1 </td>
|
|
$tccell2 $rowicon $tccell2 </center><a href=thread.php?id=$row[id]>$row[title]</a> </td>
|
|
$tccell2 <a href=profile.php?id=$cuser[id]><font $cnamecolor>$cuser[name]</font></a></td>
|
|
$tccell1 $numreplies</td>
|
|
$tccell1 $row[views]</td>
|
|
$tccell2 ".date("m-d-y h:i A",$luser['date']+$tzoff)." <br>$smallfont by <a href=profile.php?id=$luser[id]><font $lnamecolor>$luser[name]</font></a>
|
|
|
|
|
|
</tr>
|
|
|
|
";
|
|
$rowicon="";
|
|
$cuser="";
|
|
$luser="";
|
|
}
|
|
|
|
print "
|
|
</table>
|
|
</td>
|
|
</table>
|
|
";
|
|
print "<table border=0 width=100%><td align=left>$fonttag<a href=index.php>$boardname</a> - ".$forums['title']."</td><td align=right>$smallfont";
|
|
if ($_GET[id]>-1) {
|
|
print "<a href=newthread.php?id=$_GET[id]>New Thread</a>";
|
|
}
|
|
print $footer;
|
|
?>
|