I am trying to set cookie for recognizing unique users. But it doesn't work as it should, I can't set that cookie. And I have no idea why, because I've never worked with cookies before. Anyone could help me please? When I refresh the page, every time it writes "neny".
Thank you!
CODE:
<?php
$sid = mt_rand();
$cookie_name = "shid";
if (!isset($_COOKIE['shid'])) {
setcookie("shid", $sid, time()+60*60*24*100, "/");
echo "neny";
} else {
echo "Cookie '" . $cookie_name . "' is set!<br>";
echo "Value is: " . $_COOKIE[$cookie_name];
}
?>