Fixed some logic.

This commit is contained in:
Maxim Stewart 2018-04-21 23:35:32 -05:00
parent 6f2aa4fd4a
commit bf36b285d1
2 changed files with 7 additions and 5 deletions

View File

@ -2,14 +2,17 @@
// Start the session
session_start();
if (isset($_SESSION["state"])) {
$state = $_SESSION["state"];
if (isset($_SESSION["refreshState"])) {
$state = $_SESSION["refreshState"];
} else {
$state = "none";
$_SESSION["refreshState"] = $state;
}
header('Content-Type: text/event-stream');
header('Cache-Control: no-cache');
echo "data:" . $state . "\n\n";
$_SESSION["state"] = "none";
$_SESSION["refreshState"] = "none";
flush();
?>

View File

@ -52,14 +52,13 @@ function uploadFiles($targetDir) {
if ($uploadOk !== 0) {
if (move_uploaded_file($fileTmpName, $targetFile)) {
echo "<span class='success'>Server: [Success] --> The file " . $fileName . " has been uploaded.</span>";
$_SESSION["refreshState"] = "updateListing";
}
} else {
echo "<span class='error'>Server: [Error] --> Your file " . $fileName . " was not uploaded.</span>";
}
}
echo "</body></html>";
$_SESSION["state"] = "updateListing";
}
// Check access type.