diff --git a/05/auth.php b/05/auth.php index c58cb0a..2cb27a4 100644 --- a/05/auth.php +++ b/05/auth.php @@ -13,6 +13,9 @@ if ($aksi === 'login') { $password = $_POST['password'] ?? ''; if (!$email || !$password) json_out(['error'=>'Email dan password wajib diisi'],400); $stmt = $conn->prepare("SELECT u.*,r.nama AS role_nama FROM user u JOIN role r ON u.role_id=r.id WHERE u.email=? AND u.aktif=1 LIMIT 1"); + if (!$stmt) { + json_out(['error' => 'Database error: ' . $conn->error], 500); + } $stmt->bind_param('s',$email); $stmt->execute(); $user = $stmt->get_result()->fetch_assoc();