'Access denied']); exit; } // Initialize response $response = [ 'exists' => false, 'error' => null ]; // Check if username was provided if (!isset($_POST['username']) || empty($_POST['username'])) { $response['error'] = 'Username is required'; echo json_encode($response); exit; } $username = trim($_POST['username']); // Check if username exists - Updated path for v2.0 $user_files = glob("../../../users/*.json"); $user_found = false; foreach ($user_files as $file) { $user_data = json_decode(file_get_contents($file), true); if ($user_data['username'] === $username) { $user_found = true; break; } } $response['exists'] = $user_found; // Return JSON response header('Content-Type: application/json'); echo json_encode($response); ?>