<?php
require_once('config.php');

if($_POST['username']=="" || $_POST['contents']=="")
{
	echo "名字或內容為空，請重新填寫！";
}
else
{
	mysql_query("INSERT INTO `gbook_message` (username, datetime, contents) VALUES ('".$_POST['username']."', '".mktime()."', '".$_POST['contents']."')");
	header("Refresh:2; URL=gbook.php");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>範例留言板：留言已完成</title>
</head>

<body>
留言已完成，2秒後自動轉移至gbook.php...
</body>
</html>
