- 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.
33 lines
611 B
PHP
33 lines
611 B
PHP
<?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));
|
|
?>
|