Answer the question
In order to leave comments, you need to log in
How to work with cookies in php and check them
The crux of the problem is this is the code
<?php
if($_COOKIE["token"]==false){
$token = md5(uniqid());
setcookie("token", $token,time()+1209600);
echo "true";
}else{
print_r($_COOKIE["token"]);
}
?>
Answer the question
In order to leave comments, you need to log in
if(!isset($_COOKIE["token"])){
$token = md5(uniqid());
setcookie("token", $token, time()+60*60*24*30);
}else{
print_r($_COOKIE["token"]);
}
Maybe write if(!isset($_COOKIE["token"])){ instead of if($_COOKIE["token"]==false){
Via the super global array $_COOKIE. Use the search, it's elementary, there are thousands of examples on the Internet.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question