Script para un Libro de visitas en PHP

Este script es para que puedas crear un libro de visitas en PHP de una forma sencilla rápida:

<?php
// Because there is no table (tblgb)
error_reporting(0);

// Connect to DB
mysql_connect(“localhost”, “root”);
mysql_select_db(“gb”);

// Add entry
if(isset($_POST['dogbook']))
{
// Are all necessary fields set?
if(isset($_POST['gbauthor']) and isset($_POST['gbcomment']))
{
mysql_query(“INSERT INTO tblgb VALUES (”, ‘” .date(“Y-m-d H:i:s”) .”‘, ‘” .$_POST['gbauthor'] .”‘, ‘” .$_POST['gbwebsite'] .”‘, ‘” .$_POST['gbwebsite'] .”‘)”);
header(“location: ?done”);
}
else
{
header(“location: ?fillall”);
}
}
?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

<html>

<head>

<meta http-equiv=”content-type” content=”text/html; charset=iso-8859-1″ />
<meta name=”author” content=”Andreas Lagerkvist” />

<title>ExSimpleGbook</title>

</head>

<body>

<div id=”site”>

<h1>SimpleGbook</h1>

<h2>Write</h2>

<form method=”post” action=”">
<p>
<input type=”hidden” name=”dogbook” value=”1″ />

<em>*</em> Name<br />
<input type=”text” name=”gbauthor” /><br /><br />
Website<br />
<input type=”text” name=”gbwebsite” /><br /><br />
<em>*</em> Comment<br />
<textarea name=”gbcomment”></textarea><br /><br />
<input type=”submit” />
</p>
</form>

<?php
if(isset($_GET['fillall']))
{
echo “<p>Please fill out all necessary fields.</p>”;
}

echo “<h2>Read</h2>”;
echo “<ol>”;

$res = mysql_query(“SELECT * FROM tblgb ORDER BY posted DESC”);
while($row = mysql_fetch_assoc($res))
{
echo “<li><h3><a href=\”" .$row['website'] .”\”>” .$row['author'] .”</a></h3><p>” .$row['comment'] .”</p><p>” .$row['posted'] .”</p></li>”;
}
echo “</ol>”;
?>

</div>

<h1>SourceCode</h1>
<?php highlight_file(__FILE__); ?>

</body>

</html>