June 10th, 2000, 11:54 PM
I am using the new session management function from PHP4.
how do u redirect a user to another page if his session is expired?
here is what i want to do:
1. user Tom enter his correct username and password.
2. my system use session_register() function register a variable in his cookie.
3. user Tom clicked Logout
4. my system use session_destory() function and redirect Tom to the login page.
5. Now, Tom click the 'BACK' button of his browser, a page showed 'page expired, hit reload button ... ...'.
here is my question, how do I redirect Tom to the login page if he clicked the BACK button?
June 11th, 2000, 09:51 AM
i guess you should use a cookie or somewhat
trigger a variable that shows if the user is logged in or not
June 12th, 2000, 05:10 PM
if anyone else has any ideas, please let us know...
June 12th, 2000, 08:01 PM
To redirect the user...
header ("Location: Login.php4");
June 12th, 2000, 11:16 PM
You should be able to put head tags with nocache option set: Here are some header examples:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
<meta name="ROBOTS" content="INDEX, NOFOLLOW">
<meta http-equiv="refresh" content="3600">
<meta http-equiv="Window-target" content="_top">
I can't remember what the cache one is named but it is set with value "nocache".
Then user will be foreced to reload. Or set the refresh to low value, either way hope it helps.
June 17th, 2000, 04:42 PM
June 20th, 2000, 07:52 AM
This one is also nice: You can put some more useful stuff in your the header-part. This one is very useful to prevent caching:
header ("Expires: Mon, 31 Dec 1990 06:00:00 GMT");
header ("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
June 20th, 2000, 09:30 AM
<input type="button" value="Go" onClick="window.location.replace('nextpage.html');">
The current pages history entry will be replaced with the nextpage.html and this will also load the nextpage.html.
(originally posted by Spookster)
You can mess around with this to get the desired effect.