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

x
?
Solved

User loin + session timeout very urgent

Posted on 2002-07-03
3
Medium Priority
?
272 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to count occurrences of each item in an array.
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

618 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