# HG changeset patch # User Giulio Moro # Date 1456238346 0 # Node ID 96b83aa64be3a857bb472317989cb8248dc6dea5 # Parent 03b876101f053cc1fdf1dd0386aad8918de2e7f8 Actually the previous commit was broken. This contains a working and more elegant way of checking for the input file length. If the input file is empty, no error is triggered. diff -r 03b876101f05 -r 96b83aa64be3 save.php --- a/save.php Tue Feb 23 14:18:25 2016 +0000 +++ b/save.php Tue Feb 23 14:39:06 2016 +0000 @@ -7,13 +7,6 @@ $datetime = date('ymdHis'); $xmlfile = "save".$datetime."-".$sha1_hash.".xml"; $fileHandle = fopen("saves/".$xmlfile, 'w'); - if (sizeof($postText) <= 1) - { - // Filehandle failed - $xml = 'Input file empty'; - echo $xml; - return; - } if ($fileHandle == FALSE) { // Filehandle failed @@ -22,7 +15,7 @@ return; } $wbytes = fwrite($fileHandle, $postText); - if ($wbytes == FALSE) + if ($wbytes === FALSE) { // FileWrite failed $xml = 'Could not write file "saves/'.$xmlfile.'"';