|
|
cool hacks
|
|
|
|
 |
Session timeout linkback/persistant cacheing
|
 |
|
|
|
and came up with the following brilliant hack for the session time out!
Ken wrote:
When a session times out, the system returns a page
(SessionTimeoutView.pm) containing a link back to the script.
The problem is persistant cacheing with some browsers (IE) which in
essence leaves many users stranded on that page.
This hack adds a unique number to the link, which inturn creates a new
URL. The script will ignore the number when it loads.
file:
Views/eXtropia/StandardTemplates/SessionTimeoutViews
/eXtropia/StandardTemplates/SessionTimeoutView.pm
################################
# the table just cleans up the page
# you may want to change the TARGET attribute
my ($sec,$min,$hour,$mday,$mon,$year,$wday) =
(localtime(time))[0,1,2,3,4,5,6];
$content .= qq[
<table width="100%" height="100%">
<tr>
<td align="center" valign="middle">
<FONT FACE="$page_font_face" SIZE="$page_font_size">
I am sorry, but it appears that your session has timed out.<br>
Please <A HREF="$script_name?$sec$min$hour"
TARGET="main">log-in</A> to the system again.
</td>
</tr></table>
];
################################
Yes, I know, if the number was reordered it would display the time, but
then it would NOT look like a unique number to the user :-)
~.~.~.~~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
Henryk Bochmann wrote:
changed all my header() calls to
my $content = $cgi->header(-CACHE_CONTROL => 'no-cache',
-expires=>'+XXm');
(see CGI.pm for syntax)
XX is the time in minutes I choose as timeout minus a safety margin
(actually, it should be possible to get this time as variable from the script
for use in any View)
This takes care of the problem you specified.
|
|