Click to See Complete Forum and Search --> : issue with stickey fields
zap123
04-21-2009, 06:17 PM
apache 2.0.x
mod_cgi
cgi.pm
I am having problems with sticky params. When a user clicks next and the page reloads I want to disable the user from clicking the back button and forcing a reload on the page. How can I do this? I have tried the $q->delete_all(); function but that seems like it doesn't work. Thanks
Sixtease
04-22-2009, 03:18 AM
Well, disabling the back button is tricky issue, you can google it up. You can try to load the "next" page with ajax, which doesn't affect history, so the back button won't work. Since going back in history is a new request, deleting anything on the server that's just in memory (and not in persistent storage like database or files) is totally irrelevant -- everything's built up anew when the user clicks "back".
zap123
04-23-2009, 11:17 AM
Well my problem is items are staying sticky causing when a user reloads a page it cause the same functions execute again. How can I get around this? I only want the page to reload once and that's it. Thanks
Sixtease
04-23-2009, 11:23 AM
Well, HTTP protocol is stateless. Requesting the same page twice results in the same things happening, that's just the nature of HTTP. You can make workarounds but it's not a matter of stickiness, whatever that means.
You can for example send the user a cookie. Whenever you get that cookie back, you know they've been there before.
Scriptage
04-23-2009, 12:17 PM
Use CGI::Session. (http://search.cpan.org/~markstos/CGI-Session-4.41/lib/CGI/Session.pm). Check the user's session id and store a variable in the session depending on the 'state'.
$session->param('state', 1);
Then simply:
if($session->param('state') == 1){
print "Session Expired";
}
etc.