Jump to content

Cookie Length Question


Zepo.

Recommended Posts

Im not sure if its my browser doing this or what, but the cookie only seems to last as long as a session does. Heres the code.

Select

<select class='button' name='login[clength]'>
<option value='60'>1 Hour</option>
<option value='1440'>1 Day</option>
<option value='10080'>1 Week</option>
<option value='43200'>1 Month</option>
<option value='-1' selected='selected'>Forever</option>
</select>

 

Cookie Set

setcookie(tid, $getid[id], $login[clength]);
setcookie(user, $login[name], $login[clength]);
setcookie(pass, $login[pass], $login[clength]);

Link to comment
Share on other sites

First you stated it expired when you closed the browser, now you say it lasted for a day.

 

Lets make sure variables are set.

 

If you echo $login[clength], what is the value when you set the cookie?

 

The time value is based on Seconds, it looks like you are treating it as minutes, thats why I added the extra 60* in there

Link to comment
Share on other sites

setcookie(tid,$getid[id],time() + time() + 60 * $login[clength]);
setcookie(user,$login[name],time() + 60 * $login[clength]);
setcookie(pass,$login[pass],time() + 60 * $login[clength]);

 

The best i could come up with, still doesnt work.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.