Public feed
#887196
<?php
// All the starting crap.
session_start();
(db connection here)
?>
<html>
<head>
<title></title>
</head>
<body>
<?php
// Checking for $page variable in URL. If does not exist, or bogus variable, take to blog. Also accounts for secure files.
if (!(file_exists($page.".php")) || !$page || $page == "admin"){
$query ="SELECT entrytitle, entrytext, author, entryID, Date";
$query.=" FROM weblog ORDER BY entryID DESC LIMIT 10";
$result=mysql_query($query);
while (list($entrytitle,$entrytext,$author,$entryID,$Date) = mysql_fetch_row($result)){
//Counting the number of comments
$commentquery ="SELECT COUNT(entryID) FROM comments WHERE entryID=$entryID AND Approved='1'";
$commentresult=mysql_query($commentquery);
$number = mysql_fetch_row($commentresult);
$commentno = $number[0];
// Output the blog entries.
echo $entrytitle.('<br />');
echo ('('.date('D, d-m-Y H:i', $Date).') by '.$author.'<br />');
echo ('<a href="http://the-stygian.com/new/index1.php?page=comments&post='.$entryID.'">View ').$commentno.(' comments.</a><br />');
echo $entrytext.('<br /><br />');
}
}
// Otherwise include the page.
else
include ($page.".php");
?>
</body>
</html>