columnize

This commit is contained in:
awesomeuser 2023-08-02 22:31:51 +00:00
parent f768b6f7ac
commit 8e015a1405

107
index.php
View file

@ -23,8 +23,6 @@
.post {
width: 100%;
max-width: 600px;
margin: auto;
background: white;
padding: 10px;
box-sizing: border-box;
@ -55,60 +53,83 @@
}
#refresh {
max-width: 120px;
width: 120px;
margin: auto;
font-weight: 600;
text-align: center;
padding: 5px;
color: var(--accent);
cursor: pointer;
}
#center {
max-width: 1200px;
margin: auto;
display: flex;
}
#function-column, #content-column {
flex: 1;
}
</style>
</head>
<body>
<!-- header and options for making posts -->
<div class="post" style="border-top-left-radius: 0; border-top-right-radius: 0;">
<h1 style="margin-bottom: 4px;"><span style="color: var(--accent);">furp</span>social</h1>
<div id="center">
<form method="post" action="farp.php">
<textarea id="body-input" name="body"></textarea>
Signature (optional): <input id="signature-input" onchange="logSignature();" type="text" name="signature">
<input type="submit" value="Farp it">
</form>
<div id="#function-column">
<!-- header and options for making posts -->
<div class="post" style="border-top-left-radius: 0; border-top-right-radius: 0;">
<h1 style="margin-bottom: 4px;"><span style="color: var(--accent);">furp</span>social</h1>
<form method="post" action="farp.php">
<textarea id="body-input" name="body"></textarea>
Signature (optional): <input id="signature-input" onchange="logSignature();" type="text" name="signature">
<input type="submit" value="Farp it">
</form>
<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>
</div>
</div>
<div id="#content-column">
<!-- save most recent signature as a cookie and autoload on page load -->
<script>
function logSignature() {
// save signature to cookie
const d = new Date();
d.setTime(d.getTime() + (1 * 24 * 60 * 60 * 1000));
document.cookie = "signature=" + document.getElementById("signature-input").value + "; expires=" + d.toUTCString() + ";path=/";
}
// load caches signature
if (document.cookie.includes('=')) {
document.getElementById("signature-input").defaultValue = document.cookie.split('=')[1];
}
</script>
<!-- feed display -->
<div class="post" id="refresh" onclick="window.location.href = 'index.php'">refresh feed</div>
<?php
// ensure the file exists before attempting to read from it
if (!file_exists("posts.txt")) {
$myfile = fopen("posts.txt", "a");
fclose($myfile);
}
// show content
$myfile = fopen("posts.txt", "r") or die("Unable to open file!");
echo fread($myfile, filesize("posts.txt"));
fclose($myfile);
?>
</div>
<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>
</div>
<!-- save most recent signature as a cookie and autoload on page load -->
<script>
function logSignature() {
// save signature to cookie
const d = new Date();
d.setTime(d.getTime() + (1 * 24 * 60 * 60 * 1000));
document.cookie = "signature=" + document.getElementById("signature-input").value + "; expires=" + d.toUTCString() + ";path=/";
}
// load caches signature
if (document.cookie.includes('=')) {
document.getElementById("signature-input").defaultValue = document.cookie.split('=')[1];
}
</script>
<!-- feed display -->
<div class="post" id="refresh" onclick="window.location.href = 'index.php'">refresh feed</div>
<?php
// ensure the file exists before attempting to read from it
if (!file_exists("posts.txt")) {
$myfile = fopen("posts.txt", "a");
fclose($myfile);
}
// show content
$myfile = fopen("posts.txt", "r") or die("Unable to open file!");
echo fread($myfile, filesize("posts.txt"));
fclose($myfile);
?>
</body>
</html>