?
Solved

"permanent" cookies

Posted on 2002-03-31
3
Medium Priority
?
311 Views
Last Modified: 2012-06-27
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
0
Comment
Question by:Randal_Flagg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Expert Comment

by:lokeshv
ID: 6908746
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
0
 
LVL 4

Accepted Solution

by:
lokeshv earned 200 total points
ID: 6908749
0
 

Author Comment

by:Randal_Flagg
ID: 6923640
Sorry for answering so late...
Mailserver was crashed and down..
Randal
0

Featured Post

7 Extremely Useful Linux Commands for Beginners

Just getting started with Linux? Here's a quick start guide that has 7 commands that we believe will come in handy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question