From eb61c1bae2ffad114e17393d91d86fb00d7ac8cd Mon Sep 17 00:00:00 2001 From: Hannah Isopod Date: Sat, 10 May 2025 03:03:58 -0600 Subject: Initialer commit Just remade the repo because I don't *need* need a comprehensive source history for my personal website and this is easier than getting filter-repo to work good --- guestbook/submit.php | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 guestbook/submit.php (limited to 'guestbook/submit.php') diff --git a/guestbook/submit.php b/guestbook/submit.php new file mode 100644 index 0000000..09d0404 --- /dev/null +++ b/guestbook/submit.php @@ -0,0 +1,87 @@ + time(), + "name" => htmlentities($_POST["name"]), + "message" => htmlentities($_POST["message"]), + "found" => htmlentities($_POST["found"]), + "website" => $_POST["website"], + "cool" => $_POST["cool"], + "reply" => "" + ); + + $filename = "posts.json"; + + $handle = @fopen($filename, 'r+'); + + // create the file if needed + if ($handle === null) + { + $handle = fopen($filename, 'w+'); + } + + if ($handle) + { + // seek to the end + fseek($handle, 0, SEEK_END); + + // are we at the end of is the file empty + if (ftell($handle) > 0) + { + // move back a byte + fseek($handle, -2, SEEK_END); + + // add the trailing comma + fwrite($handle, ",\n", 2); + + // add the new json string + fwrite($handle, json_encode($currentPost) . "]\n"); + } + else + { + // write the first event inside an array + fwrite($handle, json_encode(array($currentPost))); + } + + // close the handle on the file + fclose($handle); + } + } + } + header("Location: ./?return=$returnCode"); +?> + + + + + Guestbook + + + + + +

Your post has been submitted! It's weird that you're seeing this page though. Maybe your browser can't process location headers? At any rate, click here"; ?> to get where you're supposed to be right now.

+ + \ No newline at end of file -- cgit v1.2.3