Location: PHPKode > projects > Horizon Blogging Software > comment.php
<?php
$time_start = microtime(TRUE);

define('IN_HBS',TRUE);

include('inc/include.php');
$cfg = getConfig();

$vars['config'] = $cfg;
$vars['title'] = $cfg['hzn_title'];
show_page('header',$vars,$cfg['template']);

db();
$commenttimestamp = strtotime("now");

if($_GET['id'] == '' || !isset($_GET['id']))
{
	$vars['error'] = "Invalid ID specified";
	show_page('post',$vars,$cfg['template']);
}
else
{
	$id = (int)$_GET['id'];

	$sql = "SELECT * FROM " . $mysql["db_prefix"] . "main WHERE `id` = $id LIMIT 1;";

	$result = mysql_query($sql) or die("This blog could not connect to the MySQL database.<br />" . $sql . "<br />" . mysql_error());
	if (mysql_num_rows($result) == 1)
	{
		$row = mysql_fetch_row($result);

		$date = date("l F d Y", $row['1']);
		$title = stripslashes($row['2']);
		$entry = stripslashes($row['3']);
		$num_rows = countComments($id);

		$vars['title'] = $title;
		$vars['id'] = $id;
		$vars['category'] = $category;
		$vars['entry'] = $entry;
		$vars['num_rows'] = $num_rows;
		$vars['date'] = $date;
		show_page('post',$vars,$cfg['template']);
	

		$sql = "SELECT * FROM " . $mysql["db_prefix"] . "comments WHERE entry='$id' ORDER BY timestamp";
		$result = mysql_query ($sql) or print ("Horizon Blogging Software could not connect to your database.<br />" . $sql . "<br />" . mysql_error());
		while($row = mysql_fetch_array($result)) {
		    $timestamp = date("l F d Y", $row['timestamp']);
		    $vars['url'] = stripslashes($row['url']);
		    $vars['name'] = stripslashes($row['name']);
		    $vars['time'] = $timestamp;
		    $vars['comment'] = stripslashes($row['comment']);
		    $vars['posted'] = TRUE;
			show_page('comment',$vars,$cfg['template']);
		}
		$vars['id'] = $id;
		$vars['commenttimestamp'] = $commenttimestamp;
		show_page('comment',$vars,$cfg['template']);
	}
	else
	{
		$vars['error'] = "Invalid ID specified";
		show_page('post',$vars,$cfg['template']);
	}
}
	
	$vars['version'] = getVersion();
show_page('footer',$vars,$cfg['template']);
$time_end = microtime(TRUE);
$time = $time_end - $time_start;
echo $time;
?>
Return current item: Horizon Blogging Software