Reputation: 800
I have a token in my MySQL database on every user. When I login this token will be stored as a cookie, but when I look at the cookie value it doesn't match the one I have in the database.
An example
In the database: $6$8J/S65L0$1bQJrlRBYTg6UTvLBKwFwRYzob2kMkv1eFuX693fVWFOiHLo6f7FXLwlo/b6WzDupUW9VrDvpqWk1F/RAncaA.
In the cookie: %246%248J%2FS65L0%241bQJrlRBYTg6UTvLBKwFwRYzob2kMkv1eFuX693fVWFOiHLo6f7FXLwlo%2Fb6WzDupUW9VrDvpqWk1F%2FRAncaA.
Why is that? I use setcookie("token", $r['token'], $expire);
to store the token as a cookie.
Upvotes: 0
Views: 252
Reputation: 499
Looks like you need to use this function: http://www.php.net/manual/en/function.htmlspecialchars-decode.php.
Edit: The values looks to be the same, just that the value in the cookie is URL encoded
Upvotes: 2