General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 27th, 2003, 09:49 PM
weisim weisim is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 11 weisim User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
session_set_cookie_params()

Hi peoples,
I was just wondering if you could help me with yet ANOHTER problem! >.<
With my website, I want to make it that you don't have to login UNLESS you logout, even after u restart ur computer etc. BUT with my webhost, I can't edit the php.ini SO I have tried using something like:

session_start();
session_set_cookie_params ("Sat Dec 4 11:55:15 MST 2010");
session_register("session");

or

session_start();
session_set_cookie_params ("315360000");
session_register("session");

and surely enough if I close my browser and restart it within a certain amount of time (I'm not sure how long, maybe an hour or something but definitely not 10 years, or till the year 2010), it'll remain logged in, but any longer than that, and I'll have to relogin. Can anyone please tell me what I'm doing wrong? Thanks.

Reply With Quote
  #2  
Old December 27th, 2003, 10:21 PM
Mike_r Mike_r is offline
ExoCrew
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 68 Mike_r User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Well for that purpose use setcookie() instead, sessions are best for per one session and not for remembering a user.

// One month cookie set
setcookie ( 'user', $userval, time() + 60*60*24*30 );

$user = $_COOKIE['user'];
__________________
ExoHelpDesk
ExoCrew Free Services

Reply With Quote
  #3  
Old January 2nd, 2004, 04:49 AM
weisim weisim is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 11 weisim User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
why doesn't it work the way I tried it though?

Reply With Quote
  #4  
Old January 2nd, 2004, 06:38 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
As Mike_r said, sessions are for one session. If you close your browser or idle for long enough for your session to time out, the session cookie expires. In order to maintain state across sessions and browser closings, you have to use cookies. Sessions are for one thing; cookies are for another; the thing you're wanting to do simply requires cookies rather than sessions.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > session_set_cookie_params()


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT