nostolgagram/NostolgaGram/api/v1/users/check_email.php
2026-06-24 21:33:55 +01:00

20 lines
No EOL
447 B
PHP

<?php
/**
* Target Path: htdocs/api/v1/users/check_email.php
*/
require_once __DIR__ . '/../../../config.php';
$email = trim($_POST['email'] ?? $_GET['email'] ?? '');
$db = getDB();
$stmt = $db->prepare("SELECT id FROM users WHERE email = ?");
$stmt->execute([$email]);
$available = $stmt->fetch() ? false : true;
http_response_code(200);
echo json_encode([
"available" => $available,
"status" => "ok"
]);
exit;