From 4e3e99ae626a6bca043c2299228a8aee9aea3d91 Mon Sep 17 00:00:00 2001 From: Janis Steiner <89935073+jakani24@users.noreply.github.com> Date: Thu, 27 Jun 2024 13:32:30 +0000 Subject: [PATCH] Update overview.php --- sys0-code/app/overview.php | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/sys0-code/app/overview.php b/sys0-code/app/overview.php index cf712cb..b6fbedb 100644 --- a/sys0-code/app/overview.php +++ b/sys0-code/app/overview.php @@ -7,6 +7,7 @@ session_start(); include "../config/config.php"; include "../api/queue.php"; $role=$_SESSION["role"]; +$username=$_SESSION["username"]; // Check if the user is logged in, if not then redirect him to login page if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){ header("location: /login/login.php"); @@ -67,6 +68,19 @@ function load_user() if(!isset($_SESSION["rid"])) $_SESSION["rid"]=0; $_SESSION["rid"]++; + + if(isset($_GET["set_class"])){ + $class_id=htmlspecialchars($_POST["class"]); + $sql="update users set class_id=$class_id where username='$username'"; + $stmt = mysqli_prepare($link, $sql); + mysqli_stmt_execute($stmt); + $sql="select name from class where id=$class_id"; + $stmt = mysqli_prepare($link, $sql); + mysqli_stmt_execute($stmt); + $class_name=""; + mysqli_stmt_bind_result($stmt, $class_name); + $_SESSION["class"]=$class_name; + } ?> Alle Drucker @@ -389,6 +403,37 @@ function load_user() ?>

+ +