test
This commit is contained in:
parent
d7ce2d5607
commit
389cd1c1cc
1 changed files with 19 additions and 22 deletions
41
index.php
41
index.php
|
@ -54,27 +54,6 @@
|
||||||
color: grey;
|
color: grey;
|
||||||
}
|
}
|
||||||
</style>
|
</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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
@ -98,8 +77,26 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?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
|
// read from file
|
||||||
sleep(3);
|
|
||||||
$myfile = fopen("posts.txt", "r") or die("Unable to open file!");
|
$myfile = fopen("posts.txt", "r") or die("Unable to open file!");
|
||||||
echo fread($myfile,filesize("posts.txt"));
|
echo fread($myfile,filesize("posts.txt"));
|
||||||
fclose($myfile);
|
fclose($myfile);
|
||||||
|
|
Reference in a new issue