feat: Add user edit modal and user management pages
- Implemented user edit modal in user_edit.html for editing user details. - Updated sidebar.html to correctly reflect active states for Users and Settings. - Created table-07.html for displaying user data in a structured format. - Added settings.html for managing email content and configurations. - Developed users.html for listing all users with functionality to add and edit users.
This commit is contained in:
34
api/users/list.php
Normal file
34
api/users/list.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
require "../api.php";
|
||||
|
||||
$api = new spamhasiApi();
|
||||
|
||||
if (!$api->checkAuth()) {
|
||||
die('{"status":500, "error":"Unauthorized"}');
|
||||
}
|
||||
|
||||
$db = $api->getDB();
|
||||
|
||||
$sql = "SELECT * FROM users";
|
||||
$stmt = $db->query($sql);
|
||||
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
$all_users = [];
|
||||
|
||||
if ($result) {
|
||||
foreach ($result as $user_res) {
|
||||
$user["id"] = $user_res["id"];
|
||||
$user["name"] = $user_res["username"];
|
||||
|
||||
$all_users[] = $user;
|
||||
}
|
||||
|
||||
$json["users"] = $all_users;
|
||||
}else{
|
||||
$json["users"] = [];
|
||||
}
|
||||
|
||||
$json["status"] = 200;
|
||||
|
||||
die(json_encode($json));
|
||||
?>
|
||||
Reference in New Issue
Block a user