Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how to destroy session after some time

Posted on 2004-04-27
4
Medium Priority
?
1,007 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 10

Accepted Solution

by:
eeBlueShadow earned 100 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 100 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

609 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