<?php
header('Content-Type: application/json');

$phone = json_decode(file_get_contents('php://input'))->phone;
$mysqli = new mysqli("localhost", "wdpdev_master", "!Panda9980", "wdpdev_washing");

if ($mysqli->connect_error) {
    die(json_encode(["exists" => false]));
}

$stmt = $mysqli->prepare("SELECT COUNT(*) FROM users WHERE phone = ?");
$stmt->bind_param("s", $phone);
$stmt->execute();
$stmt->bind_result($count);
$stmt->fetch();

echo json_encode(["exists" => $count > 0]);

$stmt->close();
$mysqli->close();
