Solved

"permanent" cookies

Posted on 2002-03-31
3
262 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
  • 2
3 Comments
 
LVL 4

Expert Comment

by:lokeshv
Comment Utility
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 50 total points
Comment Utility
0
 

Author Comment

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
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…
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now