Link to home
Start Free TrialLog in
Avatar of Randal_Flagg
Randal_Flagg

asked on

"permanent" cookies

Hi There,
how can I write a file into the cookie directory of the client?
So if the user is logged in once, that just need to look for the cookie, if the user wants to log in again.
Is that possible with setcookie?
thx Randal
Avatar of lokeshv
lokeshv

You need to set an expiration date for your cookie so that it doesn't end at the end of the browser session. Using the setcookie() function in PHP you can set it up like so:

setcookie('cookiename','cookievalue',(time()+2592000),'/','',0);

This cookie would expire in one month. You just need to change the time to whenever you want it to expire. You can also replace (time()+2592000) to "-1" and this should set the cookie to never expire if you don't want them to ever be able to vote again.



hope this wil help

Lk
ASKER CERTIFIED SOLUTION
Avatar of lokeshv
lokeshv

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Randal_Flagg

ASKER

Sorry for answering so late...
Mailserver was crashed and down..
Randal