:\\/\.,\?;'\"]+)/i", '', $text), ENT_QUOTES, 'UTF-8'));
}
////////////////////////////
//Part 2: Connect to DB
////////////////////////////
//If the DB file does NOT exist - Create it
if (!is_file("philip_data")){
//Open a connection
$dbc = sqlite_open("philip_data");
//Create table
$query = "CREATE TABLE guestbook (inputId PRIMARY KEY, inputText TEXT NOT NULL);";
sqlite_query($dbc,$query);
} else {
//Open a connection
$dbc = sqlite_open("philip_data");
}
////////////////////////////
//Part 3: Add new comments and show guestbook
////////////////////////////
if ($_POST['message']){
//Clean the Message
sanitize_text($_POST['message']);
//Clean the Name
sanitize_text($_POST['name']);
$tid = date("H:i:s d/m-Y");
//Create Guest Book log
$mess = "Posted by: {$_POST['name']} on $tid
{$_POST['message']}
| "; for($i=0;$i<$num;$i++){ $top = $i+1; $to .= "$top "; } $to .= " |