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:
33
api/users/info.php
Normal file
33
api/users/info.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
require "../api.php";
|
||||
|
||||
$api = new spamhasiApi();
|
||||
|
||||
if (!$api->checkAuth()) {
|
||||
die('{"status":500, "error":"Unauthorized"}');
|
||||
}
|
||||
|
||||
if (!isset($_POST["id"])) {
|
||||
die('{"status":500, "error":"Missing parameter"}');
|
||||
}
|
||||
|
||||
$id = intval($_POST["id"]);
|
||||
|
||||
$db = $api->getDB();
|
||||
|
||||
$sql = "SELECT id, username FROM users WHERE id = :id";
|
||||
$stmt = $db->prepare($sql);
|
||||
$stmt->execute([':id' => $id]);
|
||||
|
||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($result) {
|
||||
$json["user"] = $result;
|
||||
$json["status"] = 200;
|
||||
}else{
|
||||
$json["status"] = 500;
|
||||
$json["error"] = "Empty SQL Result";
|
||||
}
|
||||
|
||||
die(json_encode($json));
|
||||
?>
|
||||
Reference in New Issue
Block a user