<?php
// backend/api/check-user.php
header("Content-Type: application/json");
include '../config/db.php'; // Your DB connection

$wallet = $_GET['wallet'];

$query = "SELECT id FROM users WHERE wallet = '$wallet'";
$result = mysqli_query($conn, $query);

if (mysqli_num_rows($result) > 0) {
    echo json_encode(['exists' => true]);
} else {
    echo json_encode(['exists' => false]);
}
?>