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
Solved

how to destroy session after some time

Posted on 2004-04-27
4
997 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 Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…

856 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