This repository has been archived on 2024-02-28. You can view files and clone it, but cannot push or open issues or pull requests.
furpsocial/index.php

57 lines
1.8 KiB
PHP
Raw Normal View History

2023-08-01 18:57:14 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<title>furpSocial</title>
<meta charset="UTF-8">
<style>
:root {
--accent: #32a852;
}
2023-08-01 18:38:07 +00:00
2023-08-01 18:57:14 +00:00
body {
2023-08-01 19:39:25 +00:00
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
2023-08-01 18:57:14 +00:00
background: var(--accent);
margin: 0;
padding: 0;
}
2023-08-01 19:11:48 +00:00
2023-08-01 19:13:44 +00:00
#body-input {
2023-08-01 19:43:22 +00:00
width: 99%;
2023-08-01 19:13:44 +00:00
height: 150px;
2023-08-01 19:43:22 +00:00
resize: none;
2023-08-01 19:13:44 +00:00
}
2023-08-01 18:57:14 +00:00
</style>
</head>
<body>
2023-08-01 19:06:27 +00:00
<div style="width: 100%; max-width: 600px; background: white; height: 100vh; margin: auto; padding: 10px; box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-shadow: 0px 0px 10px gray;">
2023-08-01 18:57:14 +00:00
<h1 style="margin: 0; font-size: 20px;"><span style="color: var(--accent);">furp</span>social</h1>
<hr>
2023-08-01 18:38:07 +00:00
2023-08-01 19:14:40 +00:00
<form method="post">
2023-08-01 19:18:09 +00:00
<textarea id="body-input" name="body"></textarea>
2023-08-01 19:39:25 +00:00
Signature (optional): <input type="text" name="signature"><br>
2023-08-01 18:57:14 +00:00
<input type="submit">
</form>
2023-08-01 18:38:07 +00:00
2023-08-01 19:25:30 +00:00
<hr>
2023-08-01 19:45:12 +00:00
2023-08-01 21:01:43 +00:00
<?php
2023-08-01 21:14:53 +00:00
// write to file
2023-08-01 21:24:15 +00:00
if (!is_null($_POST["body"]) && strlen($_POST["body"]) != 0) {
2023-08-01 21:22:34 +00:00
$myfile = fopen("posts.txt", "a") or die("Unable to open file! (a)");
2023-08-01 21:35:39 +00:00
fwrite($myfile, htmlspecialchars($_POST["signature"]) . ": " . htmlspecialchars($_POST["body"]) . "<br>");
2023-08-01 21:22:34 +00:00
fclose($myfile);
2023-08-01 21:22:24 +00:00
}
2023-08-01 21:14:53 +00:00
// read from file
2023-08-01 21:15:19 +00:00
$myfile = fopen("posts.txt", "r") or die("Unable to open file! (r)");
2023-08-01 21:03:44 +00:00
echo fread($myfile,filesize("posts.txt"));
2023-08-01 21:01:43 +00:00
fclose($myfile);
?>
2023-08-01 19:25:30 +00:00
2023-08-01 18:57:14 +00:00
</div>
</body>
2023-08-01 18:38:07 +00:00
</html>