Update index.php
This commit is contained in:
parent
9bae2868f3
commit
06c2d53f3a
1 changed files with 5 additions and 1 deletions
|
@ -70,6 +70,10 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
// make sure the file, well, exists
|
||||||
|
$myfile = fopen("posts.txt", "a");
|
||||||
|
fclose($myfile);
|
||||||
|
|
||||||
// read file into string
|
// read file into string
|
||||||
$myfile = fopen("posts.txt", "r") or die("Unable to open file!");
|
$myfile = fopen("posts.txt", "r") or die("Unable to open file!");
|
||||||
$content = fread($myfile, filesize("posts.txt"));
|
$content = fread($myfile, filesize("posts.txt"));
|
||||||
|
@ -82,7 +86,7 @@
|
||||||
if (!is_null($_POST["signature"]) && strlen($_POST["signature"]) != 0) {
|
if (!is_null($_POST["signature"]) && strlen($_POST["signature"]) != 0) {
|
||||||
$signature = htmlspecialchars($_POST["signature"]);
|
$signature = htmlspecialchars($_POST["signature"]);
|
||||||
}
|
}
|
||||||
$content = "<div class='post'><h2>" . $signature . "</h2><i>UTC" . date("m/d/Y H:i") . "</i><div>" . htmlspecialchars($_POST["body"]) . "</div></div>" . $content;
|
$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
|
// write string back into the file
|
||||||
$myfile = fopen("posts.txt", "w") or die("Unable to open file!");
|
$myfile = fopen("posts.txt", "w") or die("Unable to open file!");
|
||||||
|
|
Reference in a new issue