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

32 lines
1.1 KiB
PHP
Raw Normal View History

2023-08-02 23:02:40 +01:00
<!DOCTYPE html>
<html>
2023-08-02 23:16:31 +01:00
<head>
<link rel="stylesheet" href="style.css">
</head>
2023-08-02 23:11:47 +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:12:08 +01:00
// write new post to file only if necessary
2023-08-04 16:41:40 +01:00
if (!is_null($_POST["image-bits"]) && strlen($_POST["image-bits"]) != 0) {
2023-08-04 17:18:44 +01:00
$myfile = fopen("posts.txt", "r") or die("Unable to read file!");
2023-08-02 23:12:08 +01:00
$content = fread($myfile, filesize("posts.txt"));
fclose($myfile);
2023-08-02 23:02:40 +01:00
// concatenate new post to the beginning of the string
$signature = "anonymous";
if (!is_null($_POST["signature"]) && strlen($_POST["signature"]) != 0) {
$signature = htmlspecialchars($_POST["signature"]);
}
2023-08-04 16:41:40 +01:00
$content = $signature . "<br>UTC " . date("Y/m/d H:i") . "<br>" . htmlspecialchars($_POST["image-bits"]) . "<br>" . $content;
2023-08-02 23:02:40 +01:00
// write string back into the file
2023-08-04 17:18:44 +01:00
$myfile = fopen("posts.txt", "w") or die("Unable to write file!");
2023-08-02 23:02:40 +01:00
fwrite($myfile, $content);
fclose($myfile);
2023-08-04 17:18:01 +01:00
} else {
echo '<script>alert("Please draw something.")</script>';
2023-08-02 23:02:40 +01:00
}
?>
</body>
</html>