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/bg.jpg | Bin 0 -> 1184070 bytes guestbook/bg.jxl | Bin 0 -> 664811 bytes guestbook/feed.php | 47 ++++++++++ guestbook/index.php | 244 +++++++++++++++++++++++++++++++++++++++++++++++++++ guestbook/submit.php | 87 ++++++++++++++++++ 5 files changed, 378 insertions(+) create mode 100644 guestbook/bg.jpg create mode 100644 guestbook/bg.jxl create mode 100644 guestbook/feed.php create mode 100644 guestbook/index.php create mode 100644 guestbook/submit.php (limited to 'guestbook') diff --git a/guestbook/bg.jpg b/guestbook/bg.jpg new file mode 100644 index 0000000..cd3b3a0 Binary files /dev/null and b/guestbook/bg.jpg differ diff --git a/guestbook/bg.jxl b/guestbook/bg.jxl new file mode 100644 index 0000000..a386f5e Binary files /dev/null and b/guestbook/bg.jxl differ diff --git a/guestbook/feed.php b/guestbook/feed.php new file mode 100644 index 0000000..7cdb62e --- /dev/null +++ b/guestbook/feed.php @@ -0,0 +1,47 @@ +'; +echo 'isopod.cool guestbook'; +echo 'The guestbook on isopod.cool'; +echo 'en-us'; +echo 'https://isopod.cool/guestbook/'; +echo 'My crappy PHP code'; + +$postlist = json_decode(file_get_contents("posts.json")); +$index = 1; +$totaloutput = ""; +foreach($postlist as $post) { + $output = ""; + $date = date("D, d M Y H:m:s", $post->date) . " GMT"; + $name = $post->name; + $message = $post->message; + $found = $post->found; + $website = $post->website; + $cool = $post->cool; + $coolsanitized = htmlentities(preg_replace("/https?:\/\//i", "", $cool)); + $reply = htmlentities($post->reply); + + if($website) { $output = $output."$name:

"; } + else { $output = $output.$name.":

"; } + + if($cool) { + $output = $output."cool thing: $coolsanitized

"; + } + + if($found) { + $output = $output."How did you find me?
$found

"; + } + + $output = $output.$message."

"; + + if($reply) { + $output = $output."
Reply:
$reply"; + } + $totaloutput = "Entry #" . $index . " - " . $name . "https://isopod.cool/guestbook/" . $date . "".htmlentities($output)."" . $index . $post->date . $name . "".$totaloutput; + $index++; +} + +echo $totaloutput; +echo "
"; \ No newline at end of file diff --git a/guestbook/index.php b/guestbook/index.php new file mode 100644 index 0000000..7d85fd1 --- /dev/null +++ b/guestbook/index.php @@ -0,0 +1,244 @@ + + + + + + + Guestbook + + + + + + +

guestbook

+

say hi!

+ + +
+ + + "; } ?> + + + + + + "; } ?> + + + + + + "; } ?> + + + + + + + + + + + "; } ?> + + + + + + "; } ?> + + + + + + "; } ?> + + + + +
Name required!
Name*
Invalid URL!
Website
Invalid URL!
Link something cool
How did you find me?
Message required!
Message*
You failed the bot check!
Bot test (six-letter scientific term for a roly-poly or woodlouse)*
Successfully posted!
+
+ setSafeMode(true); + + $totaloutput = ""; + $postlist = json_decode(file_get_contents("posts.json")); + $index = 1; + foreach($postlist as $post) { + $output = ""; + $date = date("Y-m-d h:iA", $post->date); + $name = $post->name; + $message = $Parsedown->text(html_entity_decode($post->message)); + $found = $post->found; + $website = $post->website; + $cool = $post->cool; + $coolsanitized = htmlentities(preg_replace("/https?:\/\//i", "", $cool)); + $reply = $Parsedown->text($post->reply); + + $output = $output."
"; + if($website) { $output = $output."$name"; } + else { $output = $output.$name; } + $output = $output."
$date
Entry #$index
"; + if($cool) { + $output = $output."
cool thing: $coolsanitized
"; + } + if($found) { + $output = $output."
How did you find me?
$found
"; + } + $output = $output."
$message
"; + if($reply) { + $output = $output."
Reply:
$reply
"; + } + $output = $output."
"; + $index++; + $totaloutput = $output.$totaloutput; + } + echo $totaloutput; ?> + + + 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