fixed redirect and error message on add_user dialog

This commit is contained in:
2022-06-18 10:53:01 +02:00
parent d842b431e0
commit 039e798b30

View File

@@ -3,6 +3,7 @@
include("../scripts/connection.php"); include("../scripts/connection.php");
include("../scripts/functions.php"); include("../scripts/functions.php");
$user_data = check_admin($con); $user_data = check_admin($con);
$error = null;
if($_SERVER['REQUEST_METHOD'] == "POST") { if($_SERVER['REQUEST_METHOD'] == "POST") {
$user_name = $_POST['user_name']; $user_name = $_POST['user_name'];
@@ -18,8 +19,10 @@
} else { } else {
write_user($con, $user_name, $user_id, $phash, $salt, $user_group, NULL); write_user($con, $user_name, $user_id, $phash, $salt, $user_group, NULL);
} }
header("Location: manage_user.php");
die;
} else { } else {
echo "Bitte Benutzername und Passwort eintragen!"; $error = "Bitte Benutzername und Passwort eintragen!";
} }
} }
@@ -32,6 +35,7 @@
</div> </div>
<div> <div>
<form method="post"> <form method="post">
<label><?php echo $error ?></label><br>
<label for="user_name">Benutzername</label> <label for="user_name">Benutzername</label>
<input type="text" name="user_name"/><br> <input type="text" name="user_name"/><br>
<label for="password">Passwort</label> <label for="password">Passwort</label>