This commit is contained in:
awesomeuser 2023-08-01 23:37:14 +00:00
parent d7ce2d5607
commit 389cd1c1cc

View file

@ -54,27 +54,6 @@
color: grey;
}
</style>
<?php
// write to file
if (!is_null($_POST["body"]) && strlen($_POST["body"]) != 0) {
// read into a string and concatenate new post to the beginning of the string
$myfile = fopen("posts.txt", "r") or die("Unable to open file!");
$construct = fread($myfile,filesize("posts.txt"));
fclose($myfile);
$signature = "anonymous";
if (!is_null($_POST["signature"]) && strlen($_POST["signature"]) != 0) {
$signature = htmlspecialchars($_POST["signature"]);
}
$construct = $signature . " [UTC " . date("m/d/Y H:i") . "] " . htmlspecialchars($_POST["body"]) . "<br>" . $construct;
// write back into the file
$myfile = fopen("posts.txt", "w") or die("Unable to open file!");
fwrite($myfile, $construct);
fclose($myfile);
}
?>
</head>
<body>
@ -98,8 +77,26 @@
</div>
<?php
// write to file
if (!is_null($_POST["body"]) && strlen($_POST["body"]) != 0) {
// read into a string and concatenate new post to the beginning of the string
$myfile = fopen("posts.txt", "r") or die("Unable to open file!");
$construct = fread($myfile,filesize("posts.txt"));
fclose($myfile);
$signature = "anonymous";
if (!is_null($_POST["signature"]) && strlen($_POST["signature"]) != 0) {
$signature = htmlspecialchars($_POST["signature"]);
}
$construct = $signature . " [UTC " . date("m/d/Y H:i") . "] " . htmlspecialchars($_POST["body"]) . "<br>" . $construct;
// write back into the file
$myfile = fopen("posts.txt", "w") or die("Unable to open file!");
fwrite($myfile, $construct);
fclose($myfile);
}
// read from file
sleep(3);
$myfile = fopen("posts.txt", "r") or die("Unable to open file!");
echo fread($myfile,filesize("posts.txt"));
fclose($myfile);