require("header.phtml");
function main($entry) {
?>
|
#entry($entry); ?>
|
 |
}
function get_high_entry() {
$result = mysql("lisa","SELECT id FROM rant ORDER BY id DESC LIMIT 1")
or die("Bad query: ".mysql_error());
if ($result) return mysql_result($result,0,'id');
}
function little_box($entry) {
global $PHP_SELF, $high_entry;
?>
}
function entry($id) {
global $PHP_SELF;
if ($id) {
$result = mysql("lisa","SELECT *, DATE_FORMAT(date, '%W, %M %e, %Y') as date FROM rant WHERE id=$id")
or die("Bad query: ".mysql_error());
}
else {
$result = mysql("lisa","SELECT *, DATE_FORMAT(date, '%W, %M %e, %Y') as date FROM rant ORDER BY id DESC LIMIT 1")
or die("Bad query: ".mysql_error());
}
if (!mysql_num_rows($result))
echo "No such entry";
else {
little_box($id);
$row = mysql_fetch_object($result);
$GLOBALS['entry']=$row->id;
if ($row->title)
echo "" . stripslashes($row->title) . "
\n\n";
echo "$row->date
\n\n";
$row->text = ereg_replace("(\r|\n)+","\n",$row->text);
$row->text = ereg_replace("
\n(?(UL|OL|DL|LI|DD|DT)>|$)","\n\\1",$row->text);
$row->text = stripslashes($row->text);
echo "
$row->text\n\n";
}
}
$f = mysql_pconnect("localhost","lisa","ben$91");
$high_entry = get_high_entry();
if (!$entry)
$entry=$high_entry;
#if ($list)
# entry_list($start);
#elseif ($submit)
# comment_submit();
#elseif ($comment)
# comment_form();
#else {
main($entry);
#entry($entry);
# comment($entry);
#}
require("footer.phtml");
?>