Location: PHPKode > projects > MegaBB > index.php
<?php
require("dbconnect.php");
include("include/session.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="default.css">

<title>MegaBB</title><body>

<div id="container">

<?php

include 'template/header.php';

include 'template/panel.php';
?>
<br>
<table id="threadlist" align="CENTER" border="0">
<thead>
<tr><th id="tleft" width='30%' align='center'>Thread</th><th align='center' width='20%'>Replies</th><th id="tright" width='50%' align='right'>Last post&nbsp;</th></tr>
</thead>
<tbody>

<?php

// We are selecting everything from the threads section in the database and ordering them newest to oldest.
$sql = mysql_query("SELECT * FROM threads ORDER BY posted DESC");

// Now we are getting our results and making them an array
while($r = mysql_fetch_array($sql)) {

// Everything within the two curly brackets can read from the database using $r[]
// We need to convert the UNIX Timestamp entered into the database for when a thread...
// ... is posted into a readable date, using date().
$posted = date("jS M Y h:i",$r[posted]);

?>

<?php
// Now we will show the available threads
echo "<tr><td width='30%' align='center'><a href='msg.php?id=$r[id]'>$r[title]</a></td><td align='center' width='20%'>$r[replies]</td><td id='lastpost' width='50%' align='right'>by <a href=\"userinfo.php?user=$r[author]\">$r[author]</a> <br />on $posted</td></tr>";
?>

<?php
// End of Array
}
?>
</tbody>
</table>
<br>
<?php
include("template/newthread.php");
include("template/onusers.php");
include("template/footer.php");
?>
</div>
</body></html
Return current item: MegaBB