<?php

// Function to recursively escape all values in an array
function escape_html_array($arr) {
    $escaped = [];
    foreach ($arr as $key => $value) {
        if (is_array($value)) {
            $escaped[$key] = escape_html_array($value); // Recursive escape for arrays
        } else {
            $escaped[$key] = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
        }
    }
    return $escaped;
}

// Apply escaping to all GET and POST parameters
$_GET = escape_html_array($_GET);
$_POST = escape_html_array($_POST);
?>