Solved

how to destroy session after some time

Posted on 2004-04-27
4
994 Views
Last Modified: 2008-01-09
hi,
  I'm registering a session for user of mysite, using fuctionsession_destroy();
session_start();
session_register("user");
$user = $username;

but i want that if there is no activity by user for last one hour then automatically destroy his session,
can we register  expire time with session
    Is there any way to store session for some time,
0
Comment
Question by:callshakeel
4 Comments
 
LVL 10

Accepted Solution

by:
eeBlueShadow earned 25 total points
ID: 10936154
Hi,
  You need access to your php.ini file. In it, find the setting "session.cache_expire" and set it to 60.

_Blue
0
 
LVL 2

Assisted Solution

by:Warble
Warble earned 25 total points
ID: 10940591
You can also set this in the code:

session_cache_expire(1440); // set expire to 1440 minutes or 1 day.
session_set_cookie_params(86400); // Cookie expire after 86400 seconds, or 1 day.

You must set both of these.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now