<?php
ob_start();
session_start();
include ("includes/start.php");
include ("includes/config.php");
require_once("theme.php");
$page->settitle("Home");
$page->output();
$result = mysql_query("SELECT * FROM ".PREFIX."blog ORDER BY timestamp DESC LIMIT 5") or
print (mysql_error());
while ($row = mysql_fetch_array($result))
{
$date = date("l F d Y g:i A", $row["timestamp"]);
$title = $row["title"];
$entry = BBCode($row["entry"]);
$pass = $row['password'];
$id = $row["id"];
echo "<b>$title</b><br /><br />";
echo "$entry<br /><br />";
echo "Posted on $date<br /><br />";
$result2 = mysql_query ("SELECT id FROM ".PREFIX."blog_comments WHERE entry=$id")
or print(mysql_error());
$num_rows = mysql_num_rows($result2);
if($num_rows)
{
echo "<a href=\"entry.php?id=$id\">$num_rows comments</a>";
}
else
{
echo "<a href=\"entry.php?id=$id\">leave a comment</a>";
}
echo "<hr /><br />";
}
$content->output();
include ("includes/stop.php");
$close->output();
?>