From 0907c5bde1746918f3ff36fd558f6848ce24cb1f Mon Sep 17 00:00:00 2001 From: vincent Date: Mon, 14 Apr 2025 15:12:45 +0200 Subject: [PATCH] updated to be used with new auth.php --- index.php | 59 ++++--------------------------------------------------- 1 file changed, 4 insertions(+), 55 deletions(-) diff --git a/index.php b/index.php index e72a89e..9cde162 100644 --- a/index.php +++ b/index.php @@ -4,61 +4,10 @@ * smzint/Auth (c) schmamazon.com 2025 */ -$cookie_name = "SMZ-Auth"; - -if(!isset($_COOKIE[$cookie_name])) { - echo "Cookie named '" . $cookie_name . "' is not set!"; -} else { - echo "Cookie '" . $cookie_name . "' is set!
"; - echo "Value is: " . $_COOKIE[$cookie_name]; - sessionInfos($_COOKIE[$cookie_name]); -} - -function sessionInfos($sessionId){ - - include('db.ini.php'); - - // Create connection - $conn = new mysqli($dbservername, $dbusername, $dbpassword, $dbname); - // Check connection - if ($conn->connect_error) { - die("Connection failed: " . $conn->connect_error); - } - - $sql = "SELECT * FROM smz_sessions WHERE sessionId='$sessionId'"; - $result = $conn->query($sql); - echo "

SESSION INFORMATIONS

"; - if ($result->num_rows > 0) { - // output data of each row - while($row = $result->fetch_assoc()) { - $uid = $row["uid"]; - echo "uid: " . $row["uid"]. " - creation: " . $row["creation"]. " - expiry " . $row["expiry"]. " - active " . $row["active"]. "
"; - } - } else { - echo "0 results"; - } - $conn->close(); - - // Create connection - $conn = new mysqli($dbservername, $dbusername, $dbpassword, $dbname); - // Check connection - if ($conn->connect_error) { - die("Connection failed: " . $conn->connect_error); - } - $sql = "SELECT * FROM smz_users WHERE id='$uid'"; - $result = $conn->query($sql); - echo "

USER INFORMATIONS

"; - if ($result->num_rows > 0) { - // output data of each row - while($row = $result->fetch_assoc()) { - echo "id: " . $row["id"]. " - email: " . $row["email"]. " - username " . $row["username"]. " - active " . $row["active"]. "
"; - } - } else { - echo "0 results"; - } - - $conn->close(); - echo "
"; +if (include('auth.php')){ + echo "Hallo " . $uname; +}else{ + echo "Bitte zuerst anmelden."; } ?>