im working on a remember me function and need to do e.g:
setcookie(
"cookie",
"$userid, $token, $date",
time() + (10 * 365 * 24 * 60 * 60)
);
I then want to be able to read the cookie and assign each value to a php variables:
$user id =
$token =
$date =
Any help? i have found a few examples but they dont work.
P.S. Ignore the lack of security. Im making this work and then creating all the hashing etc later.
EDIT:
Found this:
setcookie("acookie", $username . "," . $userid);
But cant get it working with a 3rd variable
Solution 1
You could do something like this (if you really want just one cookie):
Then, on the page where you're checking the cookie values, you could do this:
Solution 2
This solution is much easier and I recommend that you use this. Just make three cookies, like
$_COOKIE['user_id']
,$_COOKIE['token']
and$_COOKIE['date']
and then call them simply by those names when you need to check their values.And so on...