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.

Recommended Answers

All 14 Replies

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.

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

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.

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

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?

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.

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.

basically what i am asking is how to expire session after certain period of time.

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), or session_write_close. Descriptions and details of their use can be found on php.net.

just wondering how do i delete them if they dont logout but press exit on IE or any other browser they go on.

Lets go back to the beginning.

Are you setting the session variable? If so, how are you setting it (show code).

If you are not setting it then it is an automatic sessionID being set by the server. This will be expired automatically by the server after the period of innactivity specified in the server settings.

hi

i need to install seetion expired on my web page

please email eacarload1@yahoo.com

or call 516-765-3594

You can use session_destry() for destroying session.........

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.

how to create sessionexpire and authentication to the login page by using php code in drupal7

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.