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

114 lines
3.9 KiB
PHP
Raw Normal View History

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">
2023-08-02 23:15:41 +01:00
<link rel="stylesheet" href="style.css">
2023-08-01 19:57:14 +01:00
<style>
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
2023-08-02 22:52:26 +01:00
input[type=submit] {
float: right;
width: 100px;
background: var(--accent);
color: white;
font-weight: 600;
border: none;
cursor: pointer;
}
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;
2023-08-02 22:52:26 +01:00
border-radius: 4px;
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 22:30:49 +01:00
max-width: 120px;
font-weight: 600;
2023-08-02 01:12:23 +01:00
text-align: center;
padding: 5px;
2023-08-02 22:30:49 +01:00
color: var(--accent);
2023-08-02 22:41:57 +01:00
cursor: pointer;
2023-08-02 01:10:36 +01:00
}
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 23:20:55 +01:00
<div class="post" style="border-top-left-radius: 0; border-top-right-radius: 0;">
2023-08-02 22:52:26 +01:00
<h1 style="margin-bottom: 4px;"><span style="color: var(--accent);">furp</span>social</h1>
2023-08-02 00:32:55 +01:00
2023-08-02 23:04:07 +01:00
<form method="post" action="farp.php">
2023-08-02 22:01:14 +01:00
<textarea id="body-input" name="body"></textarea>
2023-08-02 22:38:33 +01:00
Signature (optional): <input id="signature-input" onchange="logSignature();" type="text" name="signature">
2023-08-02 22:41:57 +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>
function logSignature() {
2023-08-02 22:28:19 +01:00
// save signature to cookie
2023-08-02 22:23:15 +01:00
const d = new Date();
d.setTime(d.getTime() + (1 * 24 * 60 * 60 * 1000));
2023-08-02 22:28:19 +01:00
document.cookie = "signature=" + document.getElementById("signature-input").value + "; expires=" + d.toUTCString() + ";path=/";
2023-08-02 22:14:44 +01:00
}
// load caches signature
if (document.cookie.includes('=')) {
document.getElementById("signature-input").defaultValue = document.cookie.split('=')[1];
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 23:10:05 +01:00
// ensure the file exists before attempting to read from it
if (!file_exists("posts.txt")) {
$myfile = fopen("posts.txt", "a");
fclose($myfile);
}
2023-08-02 01:00:30 +01:00
2023-08-02 22:59:10 +01:00
// show content
2023-08-02 00:52:48 +01:00
$myfile = fopen("posts.txt", "r") or die("Unable to open file!");
2023-08-02 22:59:10 +01:00
echo fread($myfile, filesize("posts.txt"));
2023-08-02 00:52:48 +01:00
fclose($myfile);
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>