From 8f6b95b7a6f13b8412c72bd4000a8a69aa4a1dee Mon Sep 17 00:00:00 2001 From: Borgal Date: Sat, 9 Aug 2025 00:52:58 +0200 Subject: [PATCH] =?UTF-8?q?email=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/check_login.php | 3 +- index.php | 4 ++- login.php | 3 +- profil.php | 87 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 3 deletions(-) create mode 100755 profil.php diff --git a/inc/check_login.php b/inc/check_login.php index f6a710a..fd95065 100755 --- a/inc/check_login.php +++ b/inc/check_login.php @@ -24,7 +24,7 @@ if (isset($_COOKIE['auth_token']) && isset($_COOKIE['user_id'])) { $cookie_user_id = $_COOKIE['user_id']; // Datenbank-Abfrage, um den Token und die vollständigen Benutzerdaten zu erhalten - $stmt = mysqli_prepare($conn, "SELECT id, login_token, username, role FROM users WHERE id = ?"); + $stmt = mysqli_prepare($conn, "SELECT id, login_token, username, email, role FROM users WHERE id = ?"); if ($stmt) { mysqli_stmt_bind_param($stmt, "i", $cookie_user_id); @@ -39,6 +39,7 @@ if (isset($_COOKIE['auth_token']) && isset($_COOKIE['user_id'])) { // Jetzt die Benutzerdaten in die Session laden $_SESSION['user_id'] = $user['id']; $_SESSION['username'] = $user['username']; + $_SESSION['email'] = $user['email']; $_SESSION['role'] = $user['role']; return; // Authentifizierung per Cookie erfolgreich, Skript fortsetzen diff --git a/index.php b/index.php index d38e866..968d28b 100755 --- a/index.php +++ b/index.php @@ -1,7 +1,6 @@
diff --git a/login.php b/login.php index 5825d91..7bbb780 100755 --- a/login.php +++ b/login.php @@ -8,7 +8,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $password = $_POST['password']; // 1. Prepared Statement vorbereiten - $stmt = mysqli_prepare($conn, "SELECT id, username, password, role FROM users WHERE username = ?"); + $stmt = mysqli_prepare($conn, "SELECT id, username, password, email, role FROM users WHERE username = ?"); if ($stmt) { mysqli_stmt_bind_param($stmt, "s", $username); mysqli_stmt_execute($stmt); @@ -20,6 +20,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { // Authentifizierung erfolgreich, Session-Variablen setzen $_SESSION['user_id'] = $user['id']; $_SESSION['username'] = $username; + $_SESSION['email'] = $user['email']; $_SESSION['role'] = $user['role']; // Token generieren und in der Datenbank speichern diff --git a/profil.php b/profil.php new file mode 100755 index 0000000..4e3cdc1 --- /dev/null +++ b/profil.php @@ -0,0 +1,87 @@ + + +
+
+
+
+
+

Profil bearbeiten

+ + + + + +
+
+ + +
+
+ + +
+ + Abbrechen +
+
+
+
+
+
+ + \ No newline at end of file