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/farp.php

36 lines
1.1 KiB
PHP
Raw Normal View History

2023-08-02 23:02:40 +01:00
<!DOCTYPE html>
<html>
<head>
</head>
2023-08-02 23:06:58 +01:00
<body> <!-- onload="window.location.href = 'https://furp.colean.cc';" -->
2023-08-02 23:02:40 +01:00
2023-08-02 23:09:08 +01:00
<?php
2023-08-02 23:06:58 +01:00
2023-08-02 23:02:40 +01:00
$myfile = fopen("posts.txt", "r") or die("Unable to open file!");
$content = fread($myfile, filesize("posts.txt"));
fclose($myfile);
// 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
$signature = "anonymous";
if (!is_null($_POST["signature"]) && strlen($_POST["signature"]) != 0) {
$signature = htmlspecialchars($_POST["signature"]);
}
$content = "<div class='post'><h2>" . $signature . "</h2><i>UTC " . date("Y/m/d H:i") . "</i><div>" . htmlspecialchars($_POST["body"]) . "</div></div>" . $content;
// write string back into the file
$myfile = fopen("posts.txt", "w") or die("Unable to open file!");
fwrite($myfile, $content);
fclose($myfile);
2023-08-02 23:06:58 +01:00
echo $content;
echo $_POST["signature"];
echo $_POST["body"];
2023-08-02 23:02:40 +01:00
}
?>
</body>
</html>