LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 08-10-2007, 02:26 AM   #1
mohtasham1983
Member
 
Registered: Apr 2005
Location: San Jose
Distribution: Fedora 3,4- Ubuntu 6.06 to 8.10, Gentoo and Arch
Posts: 408

Rep: Reputation: 30
Question setting cookie expiration date in php


I have tried to set a cookie that can last for 6 months on users' computers one they log in to the system using:

PHP Code:
$_SESSION["loginUsername"] = $user;
$inSixMonths 60 60 24 180 time(); 
setcookie('lastVisit'date("G:i - m/d/y"), $inSixMonths); 

I don't want users to log in to my website whenever they restart their browser or even their computers, although, I know it is a security risk.

For some reason, when I'm logged in to the system and don't have any activities for a while, all session variables expire so that I have to log in again.

I have found some tricks to increase session's time out value by modifying php.ini, but I'm just wondering if it's possible to do that using php codes, since I don't have access to php.ini ?

Thanks in advance
 
Old 08-10-2007, 08:30 AM   #2
cconstantine
Member
 
Registered: Dec 2005
Distribution: RedHat, Ubuntu
Posts: 101

Rep: Reputation: 15
the second arg to setcookie() is a time_t integer. Just put your $inSixMonths var in there; don't use date() to convert. ref: http://us2.php.net/manual/en/function.setcookie.php
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Moglen: SUSE Vouchers Have No Expiration Date! (Unlike MS's Patent Bullying) LXer Syndicated Linux News 0 05-20-2007 01:01 PM
PHP : Online quiz cache control and page expiration devansh LQ Suggestions & Feedback 1 09-17-2004 01:37 PM
/etc/shadow expiration date liguorir Linux - Software 1 05-04-2004 02:42 PM
cookie expiration date in IE6 icepig Programming 2 11-17-2003 01:42 PM
Setting up Passwd expiration details deepika Linux - Newbie 1 07-17-2003 04:28 PM


All times are GMT -5. The time now is 02:48 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration