added user managment

This commit is contained in:
2022-06-09 22:20:05 +02:00
parent c769766cd5
commit 1197c6e07f
12 changed files with 167 additions and 10 deletions

View File

@@ -72,14 +72,16 @@ function load_total_score($con) {
echo "</tbody>\n";
}
function load_options_stations($con, $session) {
function load_options_stations($con, $session, $stats) {
$stmt = get_stations_all($con);
if ($session == "total-score"){
$total_score_selected = " selected";
} else {
$total_score_selected = "";
}
echo "<option value=\"total-score\"" . $total_score_selected . ">Gesamtpunkte</option>";
if($stats) {
echo "<option value=\"total-score\"" . $total_score_selected . ">Gesamtpunkte</option>";
}
foreach($stmt->fetchAll() as $option) {
if($session == $option['s_id']){
$station_selected = " selected";
@@ -124,4 +126,26 @@ function load_fire_departments($con) {
foreach($stmt->fetchAll() as $option) {
echo "<option>".$option['feuerwehr']."</option>\n";
}
}
function check_admin($con) {
$user_data = check_login($con);
if($user_data['user_group'] == "admin") {
return $user_data;
} else {
unset($_SESSION['user_id']);
unset($_SESSION['user_group']);
header("Location: login.php");
die;
}
}
function load_users($con) {
$stmt = get_users($con);
foreach($stmt->fetchAll() as $row) {
echo "<tr>\n";
echo "<td>" . $row['user_name'] . "</td>\n";
echo "<td>" . $row['user_group'] . "</td>\n";
echo "</tr>\n";
}
}