header("Content-Type: application/xhtml+xml"); ?>
$date = $_GET['date'];
$num = $_GET['num'];
$num = sprintf ("%02d", $num);
$file="$date-$num.db";
if (preg_match("/^\d\d\d\d-\d\d-\d\d$/",$date) and preg_match("/^\d\d$/",$num))
{
// print "Date '$date' and num '$num' good.
\n";
} else {
// print "Date '$date' or num '$num' bad.
\n";
print "
Error\n";
exit;
}
$db = mysql_connect("localhost","root","mysqlf00") or die("Could not connect to db.");
if (mysql_select_db("adventures",$db))
{
// print("Database opened successfully.
\n");
} else {
printf("Error opening database: %s.
\n", mysql_error());
}
$result = mysql_query("SELECT id, title FROM entries WHERE date='$date' AND num='$num'",$db);
if($myrow = mysql_fetch_array($result))
{
$title=$myrow[title];
$id=$myrow[id];
} else {
//printf("No records found: %s.
\n", mysql_error());
print "Error