Senior Trainer-Instructor- Developer C++ / C UNIX & Web-JAVA / J2EE,PhD or Masters
WSI Nationwide, Inc.
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume

Manually Expiring Web Pages
After going through a series of pages during a registration process, you don't want the user to be able to go back after the final submit. What can you do to manually "expire" those pages, and perhaps display a custom message?
In this scenario, I didn't want my session to expire as I needed it to continue. Instead, I used an extra session variable to track whether my session was alive or not. There are four main components:
(1) the entry script,
(2) the Cache-control directive,
(3) the conditional check, and
(4) manually expiring a portion of the session.
THE ENTRY SCRIPT
I use an entry script to start my session. This accomplishes two things: (1) destroys any session already in progress, and (2) starts a new session.
entry.php:

<?php
session_start
();
session_unset();
session_destroy();
session_start();
session_register('alive');
$_SESSION["alive"] = "1";
Header("Location:/php/createaccount.php");
?>
In the above script, we start the session, get rid of any registered session variables with session_unset(), and destroy that session with session_destroy(). Then, we start a new session and register a session variable. This particular variable will track whether this portion of the session is alive or not. We set the variable to some value, then we redirect to our first page in the registration series.
Next Page


Comments:
RE: page expireSunit Singh12/06/04 04:59
page expireThomas10/09/03 08:44
Thanks all!Joe Clark09/05/03 22:38
very good session techniquesuneel kanuri07/23/03 01:52
SweetPsychomantum07/17/03 18:07
SessionsDaniel07/09/03 10:51
Alternate suggestionsbarnum07/08/03 11:22
A simpler way to prevent this sort of thing..terry chay07/03/03 10:26
 

If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly.

Add A Comment:

Name:

Email:

Subject:

Message:

To reduce spam posts, messages are now manually approved

You are not [logged in]. That means your account will not get credit for this post.