Change reject action to delete user from database to allow re-registration

This commit is contained in:
ilham_gmail
2026-06-11 22:13:25 +07:00
parent 56bad098a3
commit f59fd5a24a
@@ -36,11 +36,10 @@ if($uStmt){
$uStmt->close(); $uStmt->close();
} }
// 2. Perform the update // 2. Perform the delete
$st = $conn->prepare('UPDATE users SET status = "rejected", rejection_reason = ?, approved_by = ?, approved_at = NOW() WHERE id = ?'); $st = $conn->prepare('DELETE FROM users WHERE id = ?');
if(!$st){ http_response_code(500); echo json_encode(['success'=>false,'error'=>$conn->error]); exit; } if(!$st){ http_response_code(500); echo json_encode(['success'=>false,'error'=>$conn->error]); exit; }
$adminId = intval(get_current_user_info()['id']); $st->bind_param('i', $id);
$st->bind_param('sii', $reason, $adminId, $id);
$res = $st->execute(); $res = $st->execute();
$st->close(); $st->close();
if(!$res){ http_response_code(500); echo json_encode(['success'=>false,'error'=>$conn->error]); exit; } if(!$res){ http_response_code(500); echo json_encode(['success'=>false,'error'=>$conn->error]); exit; }