menambahkan fitur edit data pengguna dan memperbarui landing page
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
require_once '../../auth.php';
|
||||
requireRole('admin');
|
||||
|
||||
header('Content-Type: application/json');
|
||||
$conn = new mysqli("localhost", "root", "", "webgis");
|
||||
|
||||
$id = (int) $_GET['id'];
|
||||
$stmt = $conn->prepare("SELECT id, nama, username, role FROM users WHERE id = ?");
|
||||
$stmt->bind_param("i", $id);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
$data = $result->fetch_assoc();
|
||||
|
||||
echo $data ? json_encode($data) : json_encode(["status" => "error", "message" => "User tidak ditemukan"]);
|
||||
|
||||
$stmt->close();
|
||||
$conn->close();
|
||||
?>
|
||||
Reference in New Issue
Block a user