$query = "SELECT * FROM news ORDER BY date DESC LIMIT 5";
 $result = mysql_query($query);
 // Check if there were any posts there
 $num = mysql_numrows($result);
 if ($num < 1) {
     echo 'No posts in database';
 } else {
     // Main loop
     $i = 0;
     while ($i < $num) {
         $id = mysql_result($result, $i, 'id');
         $title = strip_tags(mysql_result($result, $i, 'title'));
         $cat_id = mysql_result($result, $i, 'category_id');
         $date = mysql_result($result, $i, 'date');
         $poster = mysql_result($result, $i, 'poster');
         $article = parseSmilies(stripslashes(htmlentities(mysql_result($result, $i, 'short_article'))));
         $extended_article = mysql_result($result, $i, 'extended_article');
         $c_query = "SELECT * FROM comments WHERE article = '{$id}'";
         $c_result = mysql_query($c_query);
         $comments = mysql_numrows($c_result);
         $cat_query = "SELECT * FROM categories WHERE id = '{$cat_id}'";
         $cat_result = mysql_query($cat_query);
         $cat_num = mysql_numrows($cat_result);
         if ($cat_num < 1) {
             $category = 'No category';
         } else {
             $category = mysql_result($cat_result, 0, 'name');
         }
         $format = get_pref('date');
         $date = date($format, $date);
         require 'themes/' . $theme . '/article.fbt';
<?php

// FireBlog 1.0 page module - Display static pages
// Copyright (C) Alex Smith 2005
if (!isset($_GET['page'])) {
    echo 'Please give me a page ID!';
} else {
    // Get the page from the DB
    $id = $_GET['page'];
    $query = "SELECT * FROM pages WHERE id = '{$id}' LIMIT 1";
    $result = mysql_query($query);
    $num = mysql_numrows($result);
    if ($num < 1) {
        echo 'Sorry, but that page does not exist';
    } else {
        require 'inc/smiley.inc.php';
        $title = stripslashes(htmlentities(mysql_result($result, 0, 'title')));
        $page = parseSmilies(stripslashes(htmlentities(mysql_result($result, 0, 'page'))));
        $theme = get_pref('theme');
        require 'themes/' . $theme . '/page.fbt';
    }
}