?
Solved

User loin + session timeout very urgent

Posted on 2002-07-03
3
Medium Priority
?
268 Views
Last Modified: 2008-03-17
hi,am new in php
i have php4.
i know how to deal with database in php and  a basic knowledge about sessions.
how can i set a timeout for a session so i can force the user to login again ?
0
Comment
Question by:selim007
[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
  • 3
3 Comments
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 7126896
Several things.

1 - Add the datetime to the session vars and check this BEFORE processing any other session vars when you get to a new page. If the difference between the current datetime and the session datetime is greater than some limit you decide upon, then they did nothing within the timeframe specified.

If the difference is LESS than the limit, then update the datetime in the session vars.

This means if the limit is 5 minutes and I update a page every 3 minutes, the last page still has a 5 minute limit.

2 - In the <HEAD></HEAD> of the page you can ...

<meta name="refresh" content="300;url=http://www.some.com/autologout.php">
<meta name="Cache-Control" name="no-cache,no-store">

or you can put them in using header();

Regards,

Richard.
0
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 400 total points
ID: 7126904
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
                                                     // always modified
header("Cache-Control: no-store, no-cache, must-revalidate");  // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");                          // HTTP/1.0

This is from the PHP manual.

0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 7131648
Any luck?
0

Featured Post

WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

770 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