diff --git a/backend/tickets.json b/data/tickets.json similarity index 100% rename from backend/tickets.json rename to data/tickets.json diff --git a/backend/users.json b/data/users.json similarity index 100% rename from backend/users.json rename to data/users.json diff --git a/index.html b/index.html index 667da2f..b3fbc94 100644 --- a/index.html +++ b/index.html @@ -6,15 +6,16 @@ CSG Ticketsystem - -
-
-

CSG Ticketsystem

- + +
+
+

CSG Ticketsystem

+ +
+
+ + +
-
- - -
-
- + + diff --git a/js/login.js b/js/login.js index cc0b390..31338fd 100644 --- a/js/login.js +++ b/js/login.js @@ -7,15 +7,15 @@ document.getElementById("loginForm").addEventListener("submit", async function ( formData.append("username", username); formData.append("password", password); - const response = await fetch("backend/login.php", { + const response = await fetch("../php/login.php", { method: "POST", body: formData }); const result = await response.json(); if (result.success) { - window.location.href = "admin.php"; + window.location.href = "../php/admin.php"; } else { document.getElementById("errorMsg").innerText = "Login fehlgeschlagen!"; } -}); \ No newline at end of file +}); diff --git a/admin.html b/pages/admin.html similarity index 91% rename from admin.html rename to pages/admin.html index 7ecef96..0e9e8da 100644 --- a/admin.html +++ b/pages/admin.html @@ -3,12 +3,12 @@ Admin Dashboard - +

Admin Dashboard

- Logout + Logout
Tickets werden geladen...
- \ No newline at end of file + diff --git a/login.html b/pages/login.html similarity index 90% rename from login.html rename to pages/login.html index b90dd64..77be832 100644 --- a/login.html +++ b/pages/login.html @@ -10,7 +10,7 @@

Admin Login

- +
@@ -23,4 +23,4 @@
- \ No newline at end of file + diff --git a/pages/ticket_submit.html b/pages/ticket_submit.html new file mode 100644 index 0000000..30af223 --- /dev/null +++ b/pages/ticket_submit.html @@ -0,0 +1,46 @@ + + + + + + Schul-IT Ticketsystem + + + +
+
+

CSG IT Ticket System

+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/admin.php b/php/admin.php similarity index 91% rename from admin.php rename to php/admin.php index 26739fd..cdf9e3e 100644 --- a/admin.php +++ b/php/admin.php @@ -1,7 +1,7 @@ @@ -10,7 +10,7 @@ if (!isset($_SESSION["loggedIn"])) { Admin Dashboard - +
@@ -19,7 +19,7 @@ if (!isset($_SESSION["loggedIn"])) {
- Logout + Logout
@@ -40,7 +40,7 @@ let tickets = []; async function ladeTickets() { try { - const response = await fetch('backend/tickets.json?ts=' + Date.now(), {cache:"no-store"}); + const response = await fetch('../data/tickets.json?ts=' + Date.now(), {cache:"no-store"}); tickets = await response.json(); const ul = document.getElementById('tickets-ul'); @@ -91,7 +91,7 @@ function showTicketDetails(index) { const newStatus = document.getElementById('status-select').value; ticket.status = newStatus; - const res = await fetch('backend/update_ticket.php', { + const res = await fetch('./update_ticket.php', { method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({index, ticket}) @@ -108,7 +108,7 @@ function showTicketDetails(index) { document.getElementById('delete-ticket').addEventListener('click', async () => { if(!confirm("Ticket wirklich löschen?")) return; - const res = await fetch('backend/delete_ticket.php', { + const res = await fetch('./backend/delete_ticket.php', { method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({index}) @@ -127,4 +127,4 @@ function showTicketDetails(index) { ladeTickets(); - \ No newline at end of file + diff --git a/dashboard.php b/php/dashboard.php similarity index 86% rename from dashboard.php rename to php/dashboard.php index c552379..1f658aa 100644 --- a/dashboard.php +++ b/php/dashboard.php @@ -1,7 +1,7 @@ Tickets Benutzer Persönliche Einstellungen - Logout + Logout
@@ -90,7 +90,7 @@ echo "Willkommen im Dashboard, ".$_SESSION['role']."!";

Admin Dashboard

Angemeldet als:

- Logout + Logout
@@ -114,10 +114,10 @@ echo "Willkommen im Dashboard, ".$_SESSION['role']."!";

Willkommen, ${username}!

Hier siehst du eine Übersicht und kannst über die Buttons neue Bereiche öffnen:

- - - - + + + +
`; break; @@ -138,4 +138,4 @@ echo "Willkommen im Dashboard, ".$_SESSION['role']."!"; - \ No newline at end of file + diff --git a/backend/delete_ticket.php b/php/delete_ticket.php similarity index 89% rename from backend/delete_ticket.php rename to php/delete_ticket.php index 6b679bf..b61d594 100644 --- a/backend/delete_ticket.php +++ b/php/delete_ticket.php @@ -13,7 +13,7 @@ if($index === null){ exit; } -$ticketsPath = __DIR__ . '/tickets.json'; +$ticketsPath = __DIR__ . '../data/tickets.json'; $tickets = []; if(file_exists($ticketsPath)){ @@ -29,4 +29,4 @@ if(!isset($tickets[$index])){ array_splice($tickets, $index, 1); file_put_contents($ticketsPath, json_encode($tickets, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE), LOCK_EX); -echo json_encode(["success"=>true]); \ No newline at end of file +echo json_encode(["success"=>true]); diff --git a/backend/login.php b/php/login.php similarity index 80% rename from backend/login.php rename to php/login.php index af28275..037c5b7 100644 --- a/backend/login.php +++ b/php/login.php @@ -4,7 +4,7 @@ session_start(); $username = $_POST['username'] ?? ''; $password = $_POST['password'] ?? ''; -$usersFile = __DIR__ . "/users.json"; +$usersFile = __DIR__ . "../data/users.json"; if (!file_exists($usersFile)) { die("Benutzerdaten fehlen!"); } @@ -24,9 +24,9 @@ if (is_array($users)) { if ($loginOk) { $_SESSION['loggedIn'] = true; $_SESSION['username'] = $username; - header("Location: ../admin.php"); + header("Location: ./admin.php"); exit; } else { - header("Location: ../login.html?error=1"); + header("Location: ../pages/login.html?error=1"); exit; -} \ No newline at end of file +} diff --git a/backend/logout.php b/php/logout.php similarity index 52% rename from backend/logout.php rename to php/logout.php index 8627523..9b93dc3 100644 --- a/backend/logout.php +++ b/php/logout.php @@ -1,6 +1,6 @@ \ No newline at end of file +?> diff --git a/backend/save_ticket.php b/php/save_ticket.php similarity index 89% rename from backend/save_ticket.php rename to php/save_ticket.php index 69c1023..503ebf3 100644 --- a/backend/save_ticket.php +++ b/php/save_ticket.php @@ -22,7 +22,7 @@ $newTicket = [ 'date' => $date ]; -$ticketsPath = __DIR__ . '/tickets.json'; +$ticketsPath = __DIR__ . '../data/tickets.json'; $tickets = []; if (file_exists($ticketsPath)) { @@ -36,5 +36,5 @@ $tickets[] = $newTicket; file_put_contents($ticketsPath, json_encode($tickets, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE), LOCK_EX); // Redirect zurück ins Dashboard oder zur Hauptseite -header('Location: ../ticket_submit.html?success=1'); +header('Location: ../pages/ticket_submit.html?success=1'); exit; diff --git a/backend/update_ticket.php b/php/update_ticket.php similarity index 90% rename from backend/update_ticket.php rename to php/update_ticket.php index 578dfc7..2788f78 100644 --- a/backend/update_ticket.php +++ b/php/update_ticket.php @@ -14,7 +14,7 @@ if($index === null || $ticket === null){ exit; } -$ticketsPath = __DIR__ . '/tickets.json'; +$ticketsPath = __DIR__ . '../data/tickets.json'; $tickets = []; if(file_exists($ticketsPath)){ @@ -30,4 +30,4 @@ if(!isset($tickets[$index])){ $tickets[$index] = $ticket; file_put_contents($ticketsPath, json_encode($tickets, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE), LOCK_EX); -echo json_encode(["success"=>true]); \ No newline at end of file +echo json_encode(["success"=>true]); diff --git a/ticket_submit.html b/ticket_submit.html index 47dedfe..30af223 100644 --- a/ticket_submit.html +++ b/ticket_submit.html @@ -4,16 +4,16 @@ Schul-IT Ticketsystem - +

CSG IT Ticket System

- +
-
+ @@ -38,9 +38,9 @@ - +
- \ No newline at end of file +