added user managment
This commit is contained in:
@@ -171,6 +171,7 @@ function get_fire_departments($con) {
|
||||
try {
|
||||
$stmt = $con->prepare("SELECT DISTINCT feuerwehr FROM Mannschaft");
|
||||
$stmt->execute();
|
||||
$stmt->setFetchMode(PDO::FETCH_ASSOC);
|
||||
return $stmt;
|
||||
} catch(PDOException $e) {
|
||||
handle_pdo_exception($e);
|
||||
@@ -186,4 +187,30 @@ function write_team($con, $team_name, $fire_department) {
|
||||
} catch(PDOEXCEPTION $e) {
|
||||
handle_pdo_exception($e);
|
||||
}
|
||||
}
|
||||
|
||||
function get_users($con) {
|
||||
try {
|
||||
$stmt = $con->prepare("SELECT user_name, user_group FROM users");
|
||||
$stmt->execute();
|
||||
$stmt->setFetchMode(PDO::FETCH_ASSOC);
|
||||
return $stmt;
|
||||
} catch(PDOException $e) {
|
||||
handle_pdo_exception($e);
|
||||
}
|
||||
}
|
||||
|
||||
function write_user($con, $user_name, $user_id, $phash, $salt, $user_group, $s_id) {
|
||||
try {
|
||||
$stmt = $con->prepare("INSERT INTO users (user_id, password, user_name, salt, user_group, s_id) VALUES (?, ?, ?, ?, ?, ?)");
|
||||
$stmt->bindParam(1, $user_id, PDO::PARAM_STR);
|
||||
$stmt->bindParam(2, $phash, PDO::PARAM_STR);
|
||||
$stmt->bindParam(3, $user_name, PDO::PARAM_STR);
|
||||
$stmt->bindParam(4, $salt, PDO::PARAM_STR);
|
||||
$stmt->bindParam(5, $user_group, PDO::PARAM_STR);
|
||||
$stmt->bindParam(6, $s_id, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
} catch(PDOException $e) {
|
||||
handle_pdo_exception($e);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user