22 lines
510 B
PHP
22 lines
510 B
PHP
<?php
|
|
if (!isset($_SESSION)) {
|
|
$sessionName = 'hotlunch';
|
|
session_name($sessionName);
|
|
if (!session_start()) {
|
|
exit();
|
|
}
|
|
}
|
|
|
|
if (!array_key_exists('csrf_token', $_SESSION)) {
|
|
$_SESSION['csrf_token'] = str_replace('+','.',base64_encode(openssl_random_pseudo_bytes(32)));
|
|
}
|
|
?>
|
|
$.ajaxSetup({
|
|
data: window.csrf,
|
|
cache: false,
|
|
headers: {
|
|
'X-CSRF-TOKEN': '<?php echo($_SESSION['csrf_token']); ?>'
|
|
}
|
|
});
|
|
|