Flash sends "filename" and "day" to php php is then suppose to append the the file only if the last entry (if it exists) is less than the current one. filename might be "one.txt". I cant get the script to creat the file. A solution, as well as any other constructive criticisms would be appreciated.
Here is my code:
<?
$filename = $_POST['filename']; // get the filename to write to.
$day = $_POST['day']; //get day
$file = fopen("/logs/$filename", "r") or die("Could not open File"); //create/open file
$currentLogStr = fread($file, filesize($filename));
fclose($file);
$file = fopen("/logs/$filename", "a+");
if ($currentLogStr != "")
{
$currentLog = explode(" ",$currentLogStr);
if ($day > $currentLog[count($currentLog-1)])
{
fwrite($file,$day." ");
}
}else
{
fwrite($file,$day." ");
}
fclose($file);
?>