From 0a3beeeaec09df8b6573021197a7815089e65aae Mon Sep 17 00:00:00 2001 From: Grisu Date: Fri, 16 Sep 2022 09:49:36 +0200 Subject: [PATCH] fixed typo and added close button to edit pages --- app/public/edit_station.php | 41 +++++++++++--------- app/public/edit_statistics.php | 52 +++++++++++++------------ app/public/edit_team.php | 28 +++++++------- app/public/edit_user.php | 60 +++++++++++++++-------------- app/public/header_footer/header.php | 6 +-- app/public/index.php | 4 +- app/public/login.php | 4 +- 7 files changed, 103 insertions(+), 92 deletions(-) diff --git a/app/public/edit_station.php b/app/public/edit_station.php index 3f0641c..a53cac5 100644 --- a/app/public/edit_station.php +++ b/app/public/edit_station.php @@ -11,25 +11,27 @@ } if($_SERVER['REQUEST_METHOD'] == "POST") { - $station_id = sanitize_input($_POST['station_id']); - $station_name = sanitize_input($_POST['station_name']); - $station_pos = sanitize_input($_POST['station_pos']); - $station_gewertet = sanitize_input($_POST['gewertet']); - $station = get_station_all($con, $station_id)->fetch(); - $s_id = intval($station['s_id']); - $name = strval($station['name']); - $standort = strval($station['standort']); - $gewertet = intval($station['gewertet']); - if($name != $station_name) { - update_station_name($con, $s_id, $station_name); - } + if(!isset($_POST['close'])){ + $station_id = sanitize_input($_POST['station_id']); + $station_name = sanitize_input($_POST['station_name']); + $station_pos = sanitize_input($_POST['station_pos']); + $station_gewertet = sanitize_input($_POST['gewertet']); + $station = get_station_all($con, $station_id)->fetch(); + $s_id = intval($station['s_id']); + $name = strval($station['name']); + $standort = strval($station['standort']); + $gewertet = intval($station['gewertet']); + if($name != $station_name) { + update_station_name($con, $s_id, $station_name); + } - if($standort != $station_pos) { - update_station_pos($con, $s_id, $station_pos); - } + if($standort != $station_pos) { + update_station_pos($con, $s_id, $station_pos); + } - if($gewertet != $station_gewertet) { - update_station_gewertet($con, $s_id, $station_gewertet); + if($gewertet != $station_gewertet) { + update_station_gewertet($con, $s_id, $station_gewertet); + } } header("Location: stationen.php"); die; @@ -61,7 +63,10 @@ /> - +
+ + +
diff --git a/app/public/edit_statistics.php b/app/public/edit_statistics.php index 44252cb..870c74f 100644 --- a/app/public/edit_statistics.php +++ b/app/public/edit_statistics.php @@ -10,32 +10,33 @@ } if($_SERVER['REQUEST_METHOD'] == 'POST') { - $m_id = intval(sanitize_input($_POST['m_id'])); - $s_id = intval(sanitize_input($_POST['s_id'])); - $points = intval(sanitize_input($_POST['points'])); - $minutes = intval(sanitize_input($_POST['minutes'])); - $seconds = intval(sanitize_input($_POST['seconds'])); - $millis = intval(sanitize_input($_POST['millis'])); - if (get_points($con, $m_id, $s_id)->fetch()['punkte'] != $points) { - change_points($con, $m_id, $s_id, $points); + if(isset($_POST['button'])) { + $m_id = intval(sanitize_input($_POST['m_id'])); + $s_id = intval(sanitize_input($_POST['s_id'])); + $points = intval(sanitize_input($_POST['points'])); + $minutes = intval(sanitize_input($_POST['minutes'])); + $seconds = intval(sanitize_input($_POST['seconds'])); + $millis = intval(sanitize_input($_POST['millis'])); + if (get_points($con, $m_id, $s_id)->fetch()['punkte'] != $points) { + change_points($con, $m_id, $s_id, $points); + } + + if (get_minutes($con, $m_id, $s_id)->fetch()['minutes'] != $minutes || get_seconds($con, $m_id, $s_id)->fetch()['seconds'] != $seconds || get_millis($con, $m_id, $s_id)->fetch()['millis'] != $millis) { + if ($millis < 10) { + $millis = "0" . $millis; + } + + if ($minutes < 10) { + $minutes = "0" . $minutes; + } + + if ($seconds < 10) { + $seconds = "0" . $seconds; + } + $time = "00:" . $minutes . ":" . $seconds . "." . $millis; + change_time($con, $m_id, $s_id, $time); + } } - - if (get_minutes($con, $m_id, $s_id)->fetch()['minutes'] != $minutes || get_seconds($con, $m_id, $s_id)->fetch()['seconds'] != $seconds || get_millis($con, $m_id, $s_id)->fetch()['millis'] != $millis) { - if ($millis < 10) { - $millis = "0" . $millis; - } - - if ($minutes < 10) { - $minutes = "0" . $minutes; - } - - if ($seconds < 10) { - $seconds = "0" . $seconds; - } - $time = "00:" . $minutes . ":" . $seconds . "." . $millis; - change_time($con, $m_id, $s_id, $time); - } - header("Location: statistik.php"); die; } @@ -74,6 +75,7 @@ /> /> + diff --git a/app/public/edit_team.php b/app/public/edit_team.php index 05fabf4..ceae6c9 100644 --- a/app/public/edit_team.php +++ b/app/public/edit_team.php @@ -10,19 +10,20 @@ } if($_SERVER['REQUEST_METHOD'] == "POST") { - $m_id = sanitize_input($_POST['m_id']); - $team_name = sanitize_input($_POST['team_name']); - $fire_department = sanitize_input($_POST['fire_department']); - $row = get_team($con, $m_id)->fetch(); - - if($_POST['team_name'] != $row['name']) { - update_team_name($con, $m_id, $team_name); + if(isset($_POST['save'])) { + $m_id = sanitize_input($_POST['m_id']); + $team_name = sanitize_input($_POST['team_name']); + $fire_department = sanitize_input($_POST['fire_department']); + $row = get_team($con, $m_id)->fetch(); + + if($_POST['team_name'] != $row['name']) { + update_team_name($con, $m_id, $team_name); + } + + if($_POST['fire_department'] != $row['feuerwehr']) { + update_team_fire_department($con, $m_id, $fire_department); + } } - - if($_POST['fire_department'] != $row['feuerwehr']) { - update_team_fire_department($con, $m_id, $fire_department); - } - header("Location: mannschaft.php"); die; } @@ -52,7 +53,8 @@ /> - + + diff --git a/app/public/edit_user.php b/app/public/edit_user.php index 1cb6aa8..46c5f0e 100644 --- a/app/public/edit_user.php +++ b/app/public/edit_user.php @@ -11,36 +11,37 @@ } if($_SERVER['REQUEST_METHOD'] == "POST") { - $id = sanitize_input($_POST['id']); - $user = get_user($con, $id)->fetch(); - $user_group = sanitize_input($_POST['user_group']); - $user_name = sanitize_input($_POST['user_name']); - $bind_station = sanitize_input($_POST['bind_station']); - $password = sanitize_input($_POST['password']); - - if($user['user_name'] != $user_name) { - change_user_name($con, $id, $user_name); - } - - if($user['user_group'] != $user_group) { - if($user_group == "station") { - change_user_group($con, $id, $user_group, $bind_station); - } else { - change_user_group($con, $id, $user_group, NULL); + if(isset($_POST['save'])){ + $id = sanitize_input($_POST['id']); + $user = get_user($con, $id)->fetch(); + $user_group = sanitize_input($_POST['user_group']); + $user_name = sanitize_input($_POST['user_name']); + $bind_station = sanitize_input($_POST['bind_station']); + $password = sanitize_input($_POST['password']); + + if($user['user_name'] != $user_name) { + change_user_name($con, $id, $user_name); + } + + if($user['user_group'] != $user_group) { + if($user_group == "station") { + change_user_group($con, $id, $user_group, $bind_station); + } else { + change_user_group($con, $id, $user_group, NULL); + } + } + + if($user['s_id'] != $bind_station) { + if ($user_group == "station") { + change_s_id($con, $id, $bind_station); + } + } + + if(!empty($password)) { + $phash = generate_password_hash($password, $user['salt']); + change_password($con, $id, $phash); } } - - if($user['s_id'] != $bind_station) { - if ($user_group == "station") { - change_s_id($con, $id, $bind_station); - } - } - - if(!empty($password)) { - $phash = generate_password_hash($password, $user['salt']); - change_password($con, $id, $phash); - } - header("Location: manage_user.php"); die; } @@ -84,7 +85,8 @@ name="id"/> - + + diff --git a/app/public/header_footer/header.php b/app/public/header_footer/header.php index 84471d4..4cd90bd 100644 --- a/app/public/header_footer/header.php +++ b/app/public/header_footer/header.php @@ -14,7 +14,7 @@