<?php
require 'require/conn.php';

if (isset($_POST['email']) || isset($_POST['phone'])) {
    $email = $_POST['email'] ?? '';
    $phone = $_POST['phone'] ?? '';

    $query = "SELECT * FROM jamaa WHERE email = ? OR phone = ?";
    $stmt = $conn->prepare($query);
    $stmt->bind_param("ss", $email, $phone);
    $stmt->execute();
    $result = $stmt->get_result();

    if ($result->num_rows > 0) {
        echo "exists"; // Return "exists" if found
    } else {
        echo "available"; // Return "available" if not found
    }
}
?>
