Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

"permanent" cookies

Posted on 2002-03-31
3
Medium Priority
?
315 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

604 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