2023-08-01 19:57:14 +01:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
2023-08-01 23:05:45 +01:00
|
|
|
<title>furpsocial</title>
|
2023-08-01 19:57:14 +01:00
|
|
|
<meta charset="UTF-8">
|
|
|
|
<style>
|
|
|
|
:root {
|
|
|
|
--accent: #32a852;
|
|
|
|
}
|
2023-08-01 19:38:07 +01:00
|
|
|
|
2023-08-01 19:57:14 +01:00
|
|
|
body {
|
2023-08-01 20:39:25 +01:00
|
|
|
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
|
2023-08-01 19:57:14 +01:00
|
|
|
background: var(--accent);
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
}
|
2023-08-01 20:11:48 +01:00
|
|
|
|
2023-08-01 20:13:44 +01:00
|
|
|
#body-input {
|
2023-08-01 20:43:22 +01:00
|
|
|
width: 99%;
|
2023-08-01 20:13:44 +01:00
|
|
|
height: 150px;
|
2023-08-01 20:43:22 +01:00
|
|
|
resize: none;
|
2023-08-01 20:13:44 +01:00
|
|
|
}
|
2023-08-01 23:22:08 +01:00
|
|
|
|
|
|
|
.post {
|
|
|
|
width: 100%;
|
|
|
|
max-width: 600px;
|
|
|
|
margin: auto;
|
|
|
|
background: white;
|
|
|
|
padding: 10px;
|
|
|
|
box-sizing: border-box;
|
|
|
|
-moz-box-sizing: border-box;
|
|
|
|
-webkit-box-sizing: border-box;
|
|
|
|
box-shadow: 0px 0px 10px gray;
|
|
|
|
border-radius: 8px;
|
2023-08-01 23:26:11 +01:00
|
|
|
overflow: hidden;
|
2023-08-01 23:46:39 +01:00
|
|
|
margin-bottom: 10px;
|
2023-08-01 23:22:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.post h1 {
|
|
|
|
margin: 0;
|
|
|
|
font-size: 20px;
|
2023-08-01 23:27:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.post h2 {
|
|
|
|
margin: 0;
|
|
|
|
font-size: 14px;
|
2023-08-01 23:26:11 +01:00
|
|
|
padding: 10px;
|
|
|
|
margin: -10px;
|
2023-08-01 23:30:30 +01:00
|
|
|
display: inline-block;
|
|
|
|
}
|
|
|
|
|
|
|
|
.post i {
|
|
|
|
float: right;
|
|
|
|
color: grey;
|
2023-08-01 23:22:08 +01:00
|
|
|
}
|
2023-08-02 01:10:36 +01:00
|
|
|
|
|
|
|
#refresh {
|
2023-08-02 01:15:55 +01:00
|
|
|
font-weight: 600;
|
2023-08-02 01:12:23 +01:00
|
|
|
text-align: center;
|
|
|
|
padding: 5px;
|
2023-08-02 01:10:36 +01:00
|
|
|
background: var(--accent);
|
|
|
|
}
|
|
|
|
|
|
|
|
#refresh:hover {
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
2023-08-01 19:57:14 +01:00
|
|
|
</style>
|
2023-08-02 00:32:55 +01:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
2023-08-02 22:08:44 +01:00
|
|
|
<!-- header and options for making posts -->
|
2023-08-02 00:32:55 +01:00
|
|
|
<div class="post">
|
|
|
|
<h1><span style="color: var(--accent);">furp</span>social</h1>
|
|
|
|
|
2023-08-02 22:03:24 +01:00
|
|
|
<form method="post" onsubmit="logSignature();">
|
2023-08-02 22:01:14 +01:00
|
|
|
<textarea id="body-input" name="body"></textarea>
|
|
|
|
Signature (optional): <input id="signature-input" type="text" name="signature"><br>
|
2023-08-02 22:03:24 +01:00
|
|
|
<input type="submit" value="Farp it">
|
2023-08-02 00:32:55 +01:00
|
|
|
</form>
|
|
|
|
|
2023-08-02 22:08:44 +01:00
|
|
|
<span style="font-size: 12px; color: grey;">Privacy Policy: The only data collected by furpsocial server-side is the contents of your posts (signature and body text). This information is stored in our secure databases which are wiped of all post data every week. This data is only used to accomodate furpsocial as a social media platform. Client-side, furpsocial stores your most recently used signature as a cookie.</span>
|
2023-08-01 19:57:14 +01:00
|
|
|
</div>
|
|
|
|
|
2023-08-02 22:10:10 +01:00
|
|
|
<!-- save most recent signature as a cookie and autoload on page load -->
|
2023-08-02 22:08:44 +01:00
|
|
|
<script>
|
|
|
|
document.getElementById("signature-input").defaultValue = "cookie";
|
|
|
|
|
|
|
|
function logSignature() {
|
|
|
|
// save signature to cookie
|
2023-08-02 22:10:10 +01:00
|
|
|
alert(document.getElementById("signature-input").defaultValue);
|
2023-08-02 22:08:44 +01:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<!-- feed display -->
|
2023-08-02 22:10:10 +01:00
|
|
|
<div class="post" id="refresh" onclick="window.location.href = 'index.php'">refresh feed</div>
|
|
|
|
|
2023-08-01 23:37:31 +01:00
|
|
|
<?php
|
2023-08-02 01:00:30 +01:00
|
|
|
// make sure the file, well, exists
|
|
|
|
$myfile = fopen("posts.txt", "a");
|
|
|
|
fclose($myfile);
|
|
|
|
|
2023-08-02 00:52:48 +01:00
|
|
|
// read file into string
|
|
|
|
$myfile = fopen("posts.txt", "r") or die("Unable to open file!");
|
|
|
|
$content = fread($myfile, filesize("posts.txt"));
|
|
|
|
fclose($myfile);
|
|
|
|
|
2023-08-02 00:42:38 +01:00
|
|
|
// write new post to file if necessary
|
|
|
|
if (!is_null($_POST["body"]) && strlen($_POST["body"]) != 0) {
|
|
|
|
// concatenate new post to the beginning of the string
|
2023-08-02 00:37:14 +01:00
|
|
|
$signature = "anonymous";
|
|
|
|
if (!is_null($_POST["signature"]) && strlen($_POST["signature"]) != 0) {
|
|
|
|
$signature = htmlspecialchars($_POST["signature"]);
|
|
|
|
}
|
2023-08-02 01:00:30 +01:00
|
|
|
$content = "<div class='post'><h2>" . $signature . "</h2><i>UTC " . date("Y/m/d H:i") . "</i><div>" . htmlspecialchars($_POST["body"]) . "</div></div>" . $content;
|
2023-08-02 00:37:14 +01:00
|
|
|
|
2023-08-02 00:42:38 +01:00
|
|
|
// write string back into the file
|
2023-08-02 00:37:14 +01:00
|
|
|
$myfile = fopen("posts.txt", "w") or die("Unable to open file!");
|
2023-08-02 00:42:38 +01:00
|
|
|
fwrite($myfile, $content);
|
2023-08-02 00:37:14 +01:00
|
|
|
fclose($myfile);
|
|
|
|
}
|
|
|
|
|
2023-08-02 00:52:48 +01:00
|
|
|
// show content
|
|
|
|
echo $content;
|
2023-08-01 23:37:31 +01:00
|
|
|
?>
|
|
|
|
|
2023-08-01 19:57:14 +01:00
|
|
|
</body>
|
2023-08-01 19:38:07 +01:00
|
|
|
</html>
|