KStats/Public/tests/sessions.php

24 lines
746 B
PHP
Executable File

<?php
session_start();
if(isset($_GET["del"])){
session_destroy();
// setcookie("id", null, time() - 3600, "/cookies/", "kstats.local", false, true);
};
if(!isset($_COOKIE["id"])){
setcookie("id", random_int(0, 999999), [
"expires" => time() + (86400 * 30),
"path" => "/",
"domain" => $_SERVER['SERVER_NAME'],
"secure" => false,
"httponly" => true,
"samesite" => "Strict"
]);
echo "PASA<br />\n";
print_r(array_keys($_COOKIE));
};
echo (
(isset($_SESSION["id"]) ? $_SESSION["id"] : $_SESSION["id"] = random_int(0, 99999999)) . "<br />\n" .
$_COOKIE["id"]
);