Figured out php sessions...
This commit is contained in:
parent
7d9d110d16
commit
2b1b7feda6
|
@ -10,13 +10,12 @@ function openFile($FILE) {
|
||||||
shell_exec($IMGVIEWER . ' "' . $FILE . '" > /dev/null &');
|
shell_exec($IMGVIEWER . ' "' . $FILE . '" > /dev/null &');
|
||||||
} else if (preg_match('(psf|mp3|ogg|flac)', $EXTNSN) === 1) {
|
} else if (preg_match('(psf|mp3|ogg|flac)', $EXTNSN) === 1) {
|
||||||
shell_exec($MUSICPLAYER . ' "' . $FILE . '" > /dev/null &');
|
shell_exec($MUSICPLAYER . ' "' . $FILE . '" > /dev/null &');
|
||||||
|
} else if (preg_match('(odt|doc|docx|rtf)', $EXTNSN) === 1) {
|
||||||
|
shell_exec($OFFICEPROG . ' "' . $FILE . '" > /dev/null &');
|
||||||
} else if (preg_match('(txt)', $EXTNSN) === 1) {
|
} else if (preg_match('(txt)', $EXTNSN) === 1) {
|
||||||
shell_exec($TEXTVIEWER . ' "' . $FILE . '" > /dev/null &');
|
shell_exec($TEXTVIEWER . ' "' . $FILE . '" > /dev/null &');
|
||||||
} else if (preg_match('(pdf)', $EXTNSN) === 1) {
|
} else if (preg_match('(pdf)', $EXTNSN) === 1) {
|
||||||
shell_exec($PDFVIEWER . ' "' . $FILE . '" > /dev/null &');
|
shell_exec($PDFVIEWER . ' "' . $FILE . '" > /dev/null &');
|
||||||
// Has to be below b/c pdf somehow regesters as an office app.... wtf....
|
|
||||||
} else if (preg_match('(odt|doc|docx|rtf)', $EXTNSN) === 1) {
|
|
||||||
shell_exec($OFFICEPROG . ' "' . $FILE . '" > /dev/null &');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
// Prompt an update clint side when sse checks that there is updateListing.
|
// Start the session
|
||||||
$myfile = fopen("../vars.txt", "r");
|
session_start();
|
||||||
$state = fgets($myfile);
|
|
||||||
fclose($myfile);
|
|
||||||
|
|
||||||
$myfile = fopen("../vars.txt", "w");
|
if ($_SESSION["state"] != null || $_SESSION["state"] == "undefined") {
|
||||||
fclose($myfile);
|
$state = $_SESSION["state"];
|
||||||
|
}
|
||||||
|
|
||||||
header('Content-Type: text/event-stream');
|
header('Content-Type: text/event-stream');
|
||||||
header('Cache-Control: no-cache');
|
header('Cache-Control: no-cache');
|
||||||
echo "data:" . $state . "\n\n";
|
echo "data:" . $state . "\n\n";
|
||||||
|
|
||||||
|
$_SESSION["state"] = "none";
|
||||||
flush();
|
flush();
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
function uploadFiles($targetDir) {
|
function uploadFiles($targetDir) {
|
||||||
echo "<!DOCTYPE html>"
|
echo "<!DOCTYPE html>"
|
||||||
. "<head>"
|
. "<head>"
|
||||||
|
@ -56,11 +59,7 @@ function uploadFiles($targetDir) {
|
||||||
}
|
}
|
||||||
echo "</body></html>";
|
echo "</body></html>";
|
||||||
|
|
||||||
// Prompt an update clint side when sse checks that there is updateListing.
|
$_SESSION["state"] = "updateListing";
|
||||||
$myfile = fopen("resources/vars.txt", "w+");
|
|
||||||
$txt = "updateListing";
|
|
||||||
fwrite($myfile, $txt);
|
|
||||||
fclose($myfile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check access type.
|
// Check access type.
|
||||||
|
|
Loading…
Reference in New Issue