This commit is contained in:
Dávid Jančár 2024-05-29 12:19:55 +02:00
parent 05517b9144
commit 0013a2e283
2 changed files with 7 additions and 8 deletions

@ -1,7 +1,7 @@
<?php <?php
$target_dir = "uploads/";
if ($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST["submit"])) { if ($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST["submit"])) {
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1; $uploadOk = 1;
@ -23,7 +23,8 @@ if ($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST["submit"])) {
// if everything is ok, try to upload file // if everything is ok, try to upload file
} else { } else {
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
$out = "The file " . htmlspecialchars(basename($_FILES["fileToUpload"]["name"])) . " has been uploaded."; echo "The file " . htmlspecialchars(basename($_FILES["fileToUpload"]["name"])) . " has been uploaded.";
header("Location: https://slovania.adlerka.top/index.php?dano");
} else { } else {
echo "Sorry, there was an error uploading your file."; echo "Sorry, there was an error uploading your file.";
} }
@ -60,7 +61,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST["submit"])) {
$out = str_replace('__TEMPLATE_STRANKA__', $stranka_obsah, $out); $out = str_replace('__TEMPLATE_STRANKA__', $stranka_obsah, $out);
$cesta_k_skriptu = "scripty/$nazov_stranky.js"; $cesta_k_skriptu = "scripty/$nazov_stranky.js";
$script_obsah = "<script src=\"$cesta_k_skriptu\"></script>"; $script_obsah = "<script defer src=\"$cesta_k_skriptu\"></script>";
if (!file_exists($cesta_k_skriptu)) { if (!file_exists($cesta_k_skriptu)) {
$script_obsah = ''; $script_obsah = '';
} }

@ -1,5 +1,3 @@
document.onload = function () { const response = fetch("/index.php?listfiles=1");
const response = fetch("/index.php?listfiles=1"); const tabulka = document.getElementById("tabulka");
const tabulka = document.getElementById("tabulka"); tabulka.innerHTML = response.text;
tabulka.innerHTML = response.text;
}