diff --git a/index.php b/index.php index 5a0f3c9..bd9edb5 100644 --- a/index.php +++ b/index.php @@ -41,7 +41,13 @@ // write to file if (!is_null($_POST["body"]) && strlen($_POST["body"]) != 0) { $myfile = fopen("posts.txt", "a") or die("Unable to open file! (a)"); - fwrite($myfile, htmlspecialchars($_POST["signature"]) . ": " . htmlspecialchars($_POST["body"]) . "
"); + + if (strlen($_POST["signature"]) != 0) { + fwrite($myfile, htmlspecialchars($_POST["signature"]) . ": " . htmlspecialchars($_POST["body"]) . "
"); + } else { + fwrite($myfile, "anon: " . htmlspecialchars($_POST["body"]) . "
"); + } + fclose($myfile); }