<?php
require_once 'includes/head.php';
header('Content-Type: application/json');

if(isset($_POST['email'])) {
    $email = mysqli_real_escape_string($conn, $_POST['email']);
    $check = mysqli_query($conn, "SELECT id FROM users WHERE email = '$email'");
    
    echo json_encode(array(
        'exists' => mysqli_num_rows($check) > 0
    ));
}
?>