diff --git a/index.php b/index.php
index d63ab8a..4ef9cbc 100644
--- a/index.php
+++ b/index.php
@@ -1,37 +1,78 @@
500000) {
+ echo "Sorry, your file is too large.";
+ $uploadOk = 0;
+ }
+
+ // Check if $uploadOk is set to 0 by an error
+ if ($uploadOk == 0) {
+ echo "Sorry, your file was not uploaded.";
+ // if everything is ok, try to upload file
+ } else {
+ if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
+ $out = "The file " . htmlspecialchars(basename($_FILES["fileToUpload"]["name"])) . " has been uploaded.";
+ } else {
+ echo "Sorry, there was an error uploading your file.";
+ }
+ }
+} else {
+
+ $skeleton = file_get_contents('templates/skeleton.html');
+
+ $menu_obsah = file_get_contents('templates/header.html');
+ $out = str_replace('__TEMPLATE_HEADER__', $menu_obsah, $skeleton);
+
+ $footer_obsah = file_get_contents('templates/footer.html');
+ $out = str_replace('__TEMPLATE_FOOTER__', $footer_obsah, $out);
+
+ $nazov_stranky = basename($_SERVER['QUERY_STRING']);
+ if (empty($nazov_stranky)) {
+ $nazov_stranky = 'index';
+ }
+ if (!empty($_GET["listfiles"])) {
+ $files = scandir($target_dir);
+ $out = "
Názov súboru | Download |
";
+ foreach ($files as $file) {
+ $filename = $file;
+ $filepath = "/uploads/$file";
+ $out .= "SuperSubor | $filename |
";
+ }
+ } else {
+
+ $cesta_k_stranke = "stranky/$nazov_stranky.html";
+ if (!file_exists($cesta_k_stranke)) {
+ $cesta_k_stranke = "templates/404.html";
+ }
+ $stranka_obsah = file_get_contents($cesta_k_stranke);
+ $out = str_replace('__TEMPLATE_STRANKA__', $stranka_obsah, $out);
+
+ $cesta_k_skriptu = "scripty/$nazov_stranky.js";
+ $script_obsah = "";
+ if (!file_exists($cesta_k_skriptu)) {
+ $script_obsah = '';
+ }
+ $out = str_replace('__TEMPLATE_SCRIPT__', $script_obsah, $out);
+
+ $cesta_k_stylu = "styles/$nazov_stranky.css";
+ $style_obsah = "";
+ if (!file_exists($cesta_k_stylu)) {
+ $style_obsah = '';
+ }
+ $out = str_replace('__TEMPLATE_STYLE__', $style_obsah, $out);
+ }
+ echo $out;
}
-
-$cesta_k_stranke = "stranky/$nazov_stranky.html";
-if (!file_exists($cesta_k_stranke)) {
- $cesta_k_stranke = "templates/404.html";
-}
-$stranka_obsah = file_get_contents($cesta_k_stranke);
-$out = str_replace('__TEMPLATE_STRANKA__', $stranka_obsah, $out);
-
-$cesta_k_skriptu = "scripty/$nazov_stranky.js";
-$script_obsah = "";
-if (!file_exists($cesta_k_skriptu)){
- $script_obsah = '';
-}
-$out = str_replace('__TEMPLATE_SCRIPT__', $script_obsah, $out);
-
-$cesta_k_stylu = "styles/$nazov_stranky.css";
-$style_obsah = "";
-if (!file_exists($cesta_k_stylu)){
- $style_obsah = '';
-}
-$out = str_replace('__TEMPLATE_STYLE__', $style_obsah, $out);
-
-echo $out;
-?>
\ No newline at end of file
diff --git a/scripty/dano.js b/scripty/dano.js
index ec0684d..fb88def 100644
--- a/scripty/dano.js
+++ b/scripty/dano.js
@@ -1,5 +1,5 @@
document.onload = function () {
- const response = fetch("/upload.php");
+ const response = fetch("/index.php?listfiles=1");
const tabulka = document.getElementById("tabulka");
tabulka.innerHTML = response.text;
}
\ No newline at end of file
diff --git a/stranky/dano.html b/stranky/dano.html
index 59a3b15..0979090 100644
--- a/stranky/dano.html
+++ b/stranky/dano.html
@@ -1,6 +1,6 @@
-