Solved

how to destroy session after some time

Posted on 2004-04-27
4
998 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

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
PHP Mail error 3 42
PHP encrypted string and passing to a ASP Page 12 37
Echo'd values in dropdowns 6 27
MySQL-Design Help 12 38
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 …
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

735 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