Add a size check before attempting to parse the author

The author file is now checked to insure it's non-zero before attempting
to parse it for the author who's byline will be displayed at the bottom
of the post.
This commit is contained in:
20xd6 2022-08-09 14:07:40 -04:00
parent efe61157e8
commit 5d7b4cc121

View File

@ -22,7 +22,7 @@
echo "\n</div><!--End of print-content div-->\n"; echo "\n</div><!--End of print-content div-->\n";
echo("<nav class=\"jmenu\"><div class=\"pmenu\"><ul id=\"back_btn\"><li><a href='..'>Back</a></li></ul></div></nav>\n"); echo("<nav class=\"jmenu\"><div class=\"pmenu\"><ul id=\"back_btn\"><li><a href='..'>Back</a></li></ul></div></nav>\n");
if (file_exists('author')){ if (file_exists('author') && (filesize('author') != 0)){
$author_name_raw = fopen('author', 'r'); $author_name_raw = fopen('author', 'r');
$author_name = fread($author_name_raw, filesize('author')); $author_name = fread($author_name_raw, filesize('author'));
$author_name = str_replace("\n", "", $author_name); $author_name = str_replace("\n", "", $author_name);