time(), "name" => substr($name, 0, 50), "message" => substr($message, 0, 500), "timestamp" => date("c") ]; // Add new entry at the beginning array_unshift($data, $entry); // Save back to JSON file if (file_put_contents($dataFile, json_encode($data, JSON_PRETTY_PRINT)) === false) { echo "

Error: Could not save guestbook entry. Check file permissions.

"; } // Redirect to avoid form resubmission header("Location: guestbook"); exit; } } // Entries to display $entries = $data; ?> Guestbook

256phi Guestbook


|