LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Help Needed - Logging Users Out and Clearing cache or disabling back/forward buttons (http://www.linuxquestions.org/questions/programming-9/help-needed-logging-users-out-and-clearing-cache-or-disabling-back-forward-buttons-373961/)

anthonysaulnier 10-17-2005 12:29 PM

Help Needed - Logging Users Out and Clearing cache or disabling back/forward buttons
 
Hi there, I am using Perl/CGI scripting and I am trying to set up my web site so that it automatically logs people out after a pre-determined time and they will not be able to use the "go back/forward" buttons to see the full contents of the screen that they were last viewing before being logged out.

You know how if you are logged into online banking and you get automatcally logged out and you cannot go back to where you were without logging back in? Thats what I am trying to accomplish.

I do have ExpiresActive turned on and set in my Apache configuration, but that does not seem to help.

As per below, I also have the META HTTP Equiv set but that does not help either as users can still use the back buttons on their browsers to go back and see the original page and its contents. The user gets a message saying that the cache has expired but the problem is that they can still see the contents of everything as though they were actually still logged in.

Any help or ideas would be appreciated even if its in another language that can be integrated with Perl/CGI

#!/usr/bin/perl -w
#Created By Anthony Saulnier

use CGI;
use Digest::MD5 qw( md5_base64 );
$q = new CGI;
$expirytime=gmtime(time()+01*01*60)." GMT";
#basically sets the $expiry time to 60 second, but you have to put the hour and day for some reason
$username = $q->param('username');
$password = $q->param('hidden');
$submit = $q->param('submit');
$path = "/";

#$usernamecookie = $q->cookie(-name=>'$username',
# -value=>$username,
# -expires=>$expirytime,
# -domian=>$domain,
# -path=>'/');

print $q->header;

#print $q->header(-cookie=>$usernamecookie);

print qq~<META HTTP-EQUIV="Cache-Control" CONTENT="NO-CACHE">~;
print qq~<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">~;
print qq~<META HTTP-EQUIV="expires" CONTENT="0">~;


All times are GMT -5. The time now is 01:39 PM.