145 lines
4.9 KiB
PHP
145 lines
4.9 KiB
PHP
<?php
|
|
require("function.php");
|
|
require("layout.php");
|
|
|
|
//Set last forum
|
|
if($loguserid) mysqli_query($con,"UPDATE users SET lastforum = 0 WHERE id = $loguserid");
|
|
|
|
|
|
|
|
$categories=mysqli_query($con,"SELECT * FROM categories");
|
|
|
|
|
|
//Begin code for online users. Keep in mind this is mostly unmodified Acmlm's code that has been updated
|
|
$user=mysqli_query($con,"SELECT * FROM users ORDER BY regdate");
|
|
$usercount=0;
|
|
$numonline=0;
|
|
$onlineusers="";
|
|
while ($row=mysqli_fetch_array($user)) {
|
|
$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>";
|
|
}
|
|
}
|
|
|
|
//Old mark forums read code. Needs to be updated.
|
|
/*
|
|
if ($logpassword) {
|
|
$headlinks.=" | </a href=index.php?action=markallforumsread><s>Mark all forums read</s></a>";
|
|
$header=makeheader($header1,$headlinks,$header2);
|
|
}
|
|
if ($action=="markforumread" and $logpassword!="" and $users['$loguserid']['3']==$logpassword) {
|
|
$postread['$loguserid']['$forumid']=time();
|
|
$postread=writepostread($postread);
|
|
}
|
|
if ($action=="markallforumsread" and $logpassword!="" and $users['$loguserid']['3']==$logpassword) {
|
|
$f=0;
|
|
while ($forums['$f']['0']!="") {
|
|
$postread['$loguserid']['$f']=time();
|
|
$f++;
|
|
}
|
|
$postread=writepostread($postread);
|
|
}
|
|
*/
|
|
|
|
print "$header";
|
|
|
|
$logmsg="";
|
|
if ($loguserid) {
|
|
$logmsg="$smallfont"."You are logged as ".$loguser['name'].".";
|
|
}
|
|
|
|
$lasthour = time() - 3600;
|
|
$lastday = time() - 86400;
|
|
$totalthreads=mysqli_num_rows(mysqli_query($con,"SELECT * FROM threads"));
|
|
$totalposts=mysqli_num_rows(mysqli_query($con,"SELECT * FROM posts"));
|
|
$postslastday=mysqli_num_rows(mysqli_query($con,"SELECT * FROM posts WHERE date >= $lastday"));
|
|
$postslasthour=mysqli_num_rows(mysqli_query($con,"SELECT * FROM posts WHERE date >= $lasthour"));
|
|
|
|
$i=0;
|
|
print "
|
|
<br>
|
|
<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>
|
|
<td bgcolor=$tablebg1 colspan=5><center>$smallfont<table border=0 width=100%><td align=left>$logmsg</td><td align=right>$smallfont$usercount registered users<br>Latest registered user: <a href=profile.php?id=$lastuserid>$lastusername</a></td></table></td><tr>
|
|
<td bgcolor=$tablebg2 colspan=5><center>$smallfont"."$totalthreads threads and $totalposts posts in the board | $postslastday posts during the last day, $postslasthour posts during the last hour.</td><tr>
|
|
<td bgcolor=$tablebg2 colspan=5><center>$smallfont"."$numonline users currently online: $onlineusers</td></table>
|
|
</td>
|
|
</table>
|
|
|
|
";
|
|
$i=0;
|
|
$forumlist="<br>
|
|
<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>
|
|
|
|
$tccellh"." </font></td>
|
|
$tccellh"."Forum</font></td>
|
|
$tccellh"."Threads</td>
|
|
$tccellh"."Posts</td>
|
|
$tccellh"."Last post</td>";
|
|
|
|
|
|
|
|
|
|
|
|
while ($category=mysqli_fetch_assoc($categories)) {
|
|
$forumcount=0;
|
|
//$i=0;
|
|
if ($category['id']>0) {
|
|
$forumlist.="<tr>";
|
|
}
|
|
$nesticle=mysqli_query($con,"SELECT * FROM forums WHERE catid = $category[id] ORDER BY 'order' DESC");
|
|
$forumlist.="<td bgcolor=$tablebg1 colspan=5><center>$fonttag"."<b>$category[name]</td>";
|
|
while($row = mysqli_fetch_array($nesticle)) {
|
|
if ($row['catid']==$category['id']) {
|
|
|
|
|
|
|
|
|
|
$new="";
|
|
/*
|
|
if ($forumlastpost1['$i']>$postread['$loguserid']['$i'] and $forumpostcount['$i']>0 and $logpassword!="") {
|
|
$new="<img src=images/new.gif>";
|
|
}
|
|
*/
|
|
$numthreads=mysqli_num_rows(mysqli_query($con,"SELECT forum FROM threads WHERE forum = $row[id]"));
|
|
$numposts=mysqli_num_rows(mysqli_query($con,"SELECT threads.forum,threads.id,posts.thread FROM threads INNER JOIN posts ON threads.id=posts.thread WHERE forum=$row[id]"));
|
|
|
|
$luser=mysqli_fetch_array(mysqli_query($con,"SELECT threads.forum,posts.id,posts.date,users.id,users.name FROM threads INNER JOIN posts ON threads.id=posts.thread AND threads.forum=$row[id] INNER JOIN users ON posts.user=users.id ORDER BY date DESC"));
|
|
|
|
$forumlist.="<tr>$tccell1$new</td>";
|
|
$forumlist.="$tccell2"."</center><a href=forum.php?id=$row[id]>$row[title]</a></font><br>";
|
|
$forumlist.="$smallfont$row[description]</td>";
|
|
$forumlist.="$tccell1$numthreads</td>$tccell1$numposts</td>";
|
|
|
|
if ($luser['id']) {
|
|
$forumlist.="$tccell2w".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>";
|
|
}
|
|
else {
|
|
$forumlist.="$tccell2w"."-------- --:-- --";
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print "$forumlist
|
|
</table>
|
|
</td>
|
|
</table>
|
|
";
|
|
print "$footer <br>";
|
|
rendertime();
|
|
?>
|