diff --git a/README.md b/README.md index 7c2f36e..7d2d610 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,12 @@ # FSCash -Dokumentiere Ausgaben on-the-go als Webapp \ No newline at end of file +Dokumentiere Ausgaben on-the-go als Webapp +Das erste Release soll enthalten: +- mariadb setup +- apache2 setup +- Auswahl des UI frameworks +- login +- Anzeige bestehender Ausgaben des aktuellen Monats +- "+" Button zum Aufruf der Eingabemaske +- Eingabemaske für Ausgaben +- Speichern der Ausgaben in mariadb diff --git a/html/assets/css/style.css b/html/assets/css/style.css new file mode 100644 index 0000000..0de48d5 --- /dev/null +++ b/html/assets/css/style.css @@ -0,0 +1,104 @@ +/* Basis-Stile */ +body { + font-family: Arial, sans-serif; + margin: 0; + padding: 0; + background-color: #f4f4f4; +} + +/* Cookie-Hinweis */ +.cookie-notice { + position: fixed; + bottom: 0; + left: 0; + right: 0; + background: #333; + color: #fff; + padding: 10px; + text-align: center; + z-index: 1000; +} + +/* Modal */ +.modal { + display: flex; + justify-content: center; + align-items: center; + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(0,0,0,0.5); + z-index: 1001; +} +.modal-content { + background: #fff; + padding: 20px; + border-radius: 5px; + width: 90%; + max-width: 400px; +} + +/* Navigation */ +.nav { + display: flex; + justify-content: space-between; + align-items: center; + padding: 10px; + background: #333; + color: #fff; +} +.nav-list { + display: none; + list-style: none; + padding: 0; + margin: 0; +} +.nav-list li { + padding: 5px 0; +} +.hamburger { + display: block; + background: none; + border: none; + color: #fff; + font-size: 24px; + cursor: pointer; +} +.logout { + color: #fff; + text-decoration: none; +} + +/* Tabelle */ +table { + width: 100%; + border-collapse: collapse; +} +th, td { + padding: 8px; + text-align: left; + border-bottom: 1px solid #ddd; +} + +/* Button */ +.btn-new { + display: block; + background: #4CAF50; + color: white; + padding: 10px; + text-align: center; + text-decoration: none; + margin: 20px 0; +} + +/* Responsive */ +@media (min-width: 768px) { + .nav-list { + display: flex; + } + .hamburger { + display: none; + } +} diff --git a/html/assets/js/script.js b/html/assets/js/script.js new file mode 100644 index 0000000..f9409b5 --- /dev/null +++ b/html/assets/js/script.js @@ -0,0 +1,9 @@ +// Cookie-Hinweis ausblenden +document.getElementById('accept-cookies').addEventListener('click', function() { + document.getElementById('cookie-notice').style.display = 'none'; +}); + +// Hamburger-Menü +document.querySelector('.hamburger').addEventListener('click', function() { + document.querySelector('.nav-list').classList.toggle('show'); +}); diff --git a/html/config.php b/html/config.php new file mode 100644 index 0000000..edbdd43 --- /dev/null +++ b/html/config.php @@ -0,0 +1,21 @@ + PDO::ERRMODE_EXCEPTION, + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + PDO::ATTR_EMULATE_PREPARES => false, +]; + +try { + $pdo = new PDO($dsn, $user, $pass, $options); +} catch (\PDOException $e) { + throw new \PDOException($e->getMessage(), (int)$e->getCode()); +} +?> diff --git a/html/dashboard.php b/html/dashboard.php new file mode 100644 index 0000000..6ed2c2c --- /dev/null +++ b/html/dashboard.php @@ -0,0 +1,83 @@ +prepare("SELECT * FROM users WHERE username = ?"); + $stmt->execute([$_POST['username']]); + $user = $stmt->fetch(); + if ($user && password_verify($_POST['password'], $user['password'])) { + $_SESSION['user_id'] = $user['id']; + } else { + header('Location: index.php'); + exit; + } +} + +// Daten abrufen +$stmt = $pdo->prepare("SELECT * FROM entries WHERE user_id = ?"); +$stmt->execute([$_SESSION['user_id']]); +$entries = $stmt->fetchAll(); +?> + + + + + + FinanzApp - Dashboard + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
DatumKategorieZahlweiseBetreffBetrag
+ + + Neu +
+ + + + diff --git a/html/index.php b/html/index.php new file mode 100644 index 0000000..defb6a2 --- /dev/null +++ b/html/index.php @@ -0,0 +1,37 @@ + + + + + + +FinanzApp - Login + + + + + + + + + + + + diff --git a/html/logout.php b/html/logout.php new file mode 100644 index 0000000..e5ab4b6 --- /dev/null +++ b/html/logout.php @@ -0,0 +1,6 @@ + diff --git a/html/menu1.php b/html/menu1.php new file mode 100644 index 0000000..5279c34 --- /dev/null +++ b/html/menu1.php @@ -0,0 +1,22 @@ + + + + + + + FinanzApp - Menüpunkt X + + + +
+

Menüpunkt X

+

Hier kommt der Inhalt für Menüpunkt X.

+
+ + diff --git a/html/menu2.php b/html/menu2.php new file mode 100644 index 0000000..5279c34 --- /dev/null +++ b/html/menu2.php @@ -0,0 +1,22 @@ + + + + + + + FinanzApp - Menüpunkt X + + + +
+

Menüpunkt X

+

Hier kommt der Inhalt für Menüpunkt X.

+
+ + diff --git a/html/menu3.php b/html/menu3.php new file mode 100644 index 0000000..5279c34 --- /dev/null +++ b/html/menu3.php @@ -0,0 +1,22 @@ + + + + + + + FinanzApp - Menüpunkt X + + + +
+

Menüpunkt X

+

Hier kommt der Inhalt für Menüpunkt X.

+
+ + diff --git a/html/menu4.php b/html/menu4.php new file mode 100644 index 0000000..5279c34 --- /dev/null +++ b/html/menu4.php @@ -0,0 +1,22 @@ + + + + + + + FinanzApp - Menüpunkt X + + + +
+

Menüpunkt X

+

Hier kommt der Inhalt für Menüpunkt X.

+
+ + diff --git a/html/menu5.php b/html/menu5.php new file mode 100644 index 0000000..5279c34 --- /dev/null +++ b/html/menu5.php @@ -0,0 +1,22 @@ + + + + + + + FinanzApp - Menüpunkt X + + + +
+

Menüpunkt X

+

Hier kommt der Inhalt für Menüpunkt X.

+
+ + diff --git a/html/new_entry.php b/html/new_entry.php new file mode 100644 index 0000000..7085af4 --- /dev/null +++ b/html/new_entry.php @@ -0,0 +1,29 @@ + + + + + + + FinanzApp - Neuer Eintrag + + + +
+

Neuer Eintrag

+
+ + + + + + +
+
+ + diff --git a/init_sql.sql b/init_sql.sql new file mode 100644 index 0000000..e3d9303 --- /dev/null +++ b/init_sql.sql @@ -0,0 +1,26 @@ +-- Datenbank erstellen +CREATE DATABASE IF NOT EXISTS finanzapp; +USE finanzapp; + +-- Tabelle für Benutzer +CREATE TABLE IF NOT EXISTS users ( + id INT AUTO_INCREMENT PRIMARY KEY, + username VARCHAR(50) NOT NULL UNIQUE, + password VARCHAR(255) NOT NULL +); + +-- Tabelle für Einträge +CREATE TABLE IF NOT EXISTS entries ( + id INT AUTO_INCREMENT PRIMARY KEY, + user_id INT NOT NULL, + date DATE NOT NULL, + category VARCHAR(50), + subject VARCHAR(255) NOT NULL, + amount DECIMAL(10,2) NOT NULL, + payment_method VARCHAR(50), + FOREIGN KEY (user_id) REFERENCES users(id) +); + +-- Testbenutzer einfügen (Passwort: "test123") +INSERT INTO users (username, password) VALUES ('testuser', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'); +