anthonysaulnier
10-17-2005, 03:51 PM
Good day, I am trying to write a perl and cgi script that disables cache, so that users simply cannot use the "back or forward" button on their browsers. I want them to have to log in again once their time expires. I have tried using ExpiresActive in the Apache configuration file, but no luck. I have also tried the following with no luck either:
#!/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 = "/";
$domain = "http://www.anthonysaulnier.com";
#$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">~;
print qq~<meta http-equiv="Refresh" content="65; url=http://10.0.0.1/cgi-bin/customers/mainlogin.cgi">~;
The user gets the message saying that cache is expired, but in reality it doesnt seem to expire. I know that it can be done because this happens with on-line banking services. When your time runs out or you are idle too long you get logged out and have to actually log back in again.
If anyone has any ideas it would be very much appreciated. I am even open to new ideas with different languages as long as it can be used with perl/cgi.
Thank you.
Anthony
#!/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 = "/";
$domain = "http://www.anthonysaulnier.com";
#$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">~;
print qq~<meta http-equiv="Refresh" content="65; url=http://10.0.0.1/cgi-bin/customers/mainlogin.cgi">~;
The user gets the message saying that cache is expired, but in reality it doesnt seem to expire. I know that it can be done because this happens with on-line banking services. When your time runs out or you are idle too long you get logged out and have to actually log back in again.
If anyone has any ideas it would be very much appreciated. I am even open to new ideas with different languages as long as it can be used with perl/cgi.
Thank you.
Anthony