Jump to content
Larry Ullman's Book Forums

Recommended Posts

Hello,

I have been working on script 12.5. which allows to set cookie's parameters.

As the example in the book shows, I wanted to set cookie that expires within 1h from creation.
 

setcookie('user_id', $data['user_id'], time() + 3600, '/', '', 0, 0);

When checking the cookie after successful signing-in, Expires: always says Session.

Why is that?

 

Thank

Share this post


Link to post
Share on other sites

I'd first confirm that you're looking at the right cookie. Perhaps start by trying it with a new cookie with a new name, just to confirm.

Share this post


Link to post
Share on other sites

I am 100% sure I am looking at the correct cookie.
No matter how I set expiration parameter it always says "Session".
If I set expiration to time()+60 it actually expires after 60 seconds and I am not able to see restricted content.
So it works but I do not see this value when I view cookie.

Share this post


Link to post
Share on other sites

Okay. I would still start debugging this by trying it with a fresh, new cookie. Also, always good to test such things in different browsers to see if it's particular to one browser or not.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...