944,098 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 29969
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
Nov 25th, 2005
0

How to expire a session

Expand Post »
I am new with session.

What i am trying to do is that if someone doesn't visit my site for lets say 5 day i want the session to expire. is there a way to do this as i am not aware of it.
Similar Threads
Reputation Points: 10
Solved Threads: 1
Junior Poster
ashneet is offline Offline
147 posts
since Jun 2005
Nov 26th, 2005
0

Re: How to expire a session

Sessions are set automatically by the server on page load, and the default life of a session is 20 minutes. If you are overriding this setting (which is acceptable) and you are setting it to ndays (which is highly unnacteptable) then you are putting an incredibly heavy load on your server memory and will cause a whole load of pain for yourself.

It may help our understanding of your situation if you detail exactly what sessions you are refering to and how they are being assigned.
Reputation Points: 16
Solved Threads: 7
Junior Poster
Lafinboy is offline Offline
166 posts
since Jul 2004
Nov 29th, 2005
0

Re: How to expire a session

then tell me this when an a session expire is it deleated on the server as i use sessons and they just take a lot of space on the server because for some reason they are just gathering there
Reputation Points: 10
Solved Threads: 1
Junior Poster
ashneet is offline Offline
147 posts
since Jun 2005
Nov 30th, 2005
0

Re: How to expire a session

Have you changed the default session lifetime? How are you setting the sessions?

As stated, server sessions are managed automatically by the server, but some of the defaults can be overridden by code.
Reputation Points: 16
Solved Threads: 7
Junior Poster
Lafinboy is offline Offline
166 posts
since Jul 2004
Nov 30th, 2005
0

Re: How to expire a session

I havent messed with any part of my server as i use yahoo server and they dont let me change any thing in it.

If you wana look at my server setting you can find them at http://www.eezs.com/test/test.php
Reputation Points: 10
Solved Threads: 1
Junior Poster
ashneet is offline Offline
147 posts
since Jun 2005
Nov 30th, 2005
0

Re: How to expire a session

Well the server settings are all kinda standard, so no problem there. I noticed you are setting a cookie named BX and you have set a life of 5 years on it. Is this what you are referring to?
Reputation Points: 16
Solved Threads: 7
Junior Poster
Lafinboy is offline Offline
166 posts
since Jul 2004
Dec 1st, 2005
0

Re: How to expire a session

I have no idea what that cookie is so i dont need 2 worry about it but is there a way to forcefully expire sesson and delete it from the server so they dont just sit there and pile up.
Reputation Points: 10
Solved Threads: 1
Junior Poster
ashneet is offline Offline
147 posts
since Jun 2005
Dec 1st, 2005
0

Re: How to expire a session

Still have no idea what sessions you are refering to. Can you post a screenshot of the sessions you are talking about? Where are the 'sessions' being stored? If you are physically setting a session variable or persistent cookie then you can delete/expire/unset that session variable based on a time calculation. If the session variable is a server generated session variable then it will expire automatically based on the lifetime setting in the server.
Reputation Points: 16
Solved Threads: 7
Junior Poster
Lafinboy is offline Offline
166 posts
since Jul 2004
Dec 2nd, 2005
0

Re: How to expire a session

basically what i am asking is how to expire session after certain period of time.
Reputation Points: 10
Solved Threads: 1
Junior Poster
ashneet is offline Offline
147 posts
since Jun 2005
Dec 2nd, 2005
0

Re: How to expire a session

There are couple of methods depending on how the sessions are set and how much of the session data you actually want to destroy.

Have a look at using session_destroy, session_unset, unset('$_SESSION['$varname']), or session_write_close. Descriptions and details of their use can be found on php.net.
Reputation Points: 16
Solved Threads: 7
Junior Poster
Lafinboy is offline Offline
166 posts
since Jul 2004

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: EasyPHP or AMPPS for Desktop?
Next Thread in PHP Forum Timeline: Question:Posting a list





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC