<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

$blockedFile = __DIR__ . '/blocked.txt';

if (file_exists($blockedFile)) {
    $blocked_ips = file($blockedFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    $ip = $_SERVER['REMOTE_ADDR'];

    if (in_array($ip, $blocked_ips)) {
        // Redirect to internal location
        header("Location: /adv/confirmation-done.php");
        exit;
    }
} else {
    die('Error: "blocked.txt" file not found.');
}
?>
