Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I expire a dynamic page using Perl?

Status
Not open for further replies.

Mikeinutah

Programmer
Nov 15, 2003
9
US
I need to set an expiration date on a form page so that it will expire. This is necessay so that user of the form can't hit the browsers back button and re-populate the fields with past information.

I am using the following code and it works just fine in Firefox, but it doesn't work in IE or Opera. What am I doing wrong?
Code:
print header(-type => 'text/html',
             -expires =>'Wed, 15 Jul 2004 00:00:00 GMT',
             -Last-Modified =>'Wed, 15 Jul 2004 00:00:00 GMT',
             -cookie => $User_cart, 
             -Pragma => 'no-cache',
             -Cache_Control => 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0');


Any help would be greatly appreciated.


Thanks.......Mike
 
I'm a big Opera user, and it nearly always keeps pages in history populated and cached. I personally love that feature. I hate using IE and getting that "page expired" notice. The above line is about all you can do, and will ensure that when a user hits the site for the first time, it will get a fresh copy.

I'm curious, why would it be a requirement that the user not cache a page they were at 30 seconds ago?

Oh, reminds of IPB forums. On a post, after clicking the submit button, javascript disables the submit button before posting the form. So users can go back, but the submit button is disabled and they can't repost. Are you trying to avoid duplicate postings?

________________________________________
Andrew
 
Andrew,

Thanks for responding! The page I want to expires is part of a "shopping cart". It is created dynamically thru a perl CGI.

The reason I need to expire the page is that the shipping cost is calculated by the user submitting it. The page is then sent back to them for approval, changes or subbmission for payment. If they use the back button there exist the possibility that changes were made. If I expire the page it will force the browser to re-submit when the back or forward buttons are clicked thereby keeping the page information and calculations correct for the values they see. They will not get a page expired warning because the page is created dynamically.

Like I said before - this works great in Firefox but IE and opera cache the page and therefor do not force a refresh.

-Mike
 
hrm, we're doing the same thing with our checkout in ASP.NET at work, and the page expirations work fine in IE but not in opera (haven't tried firefox).

Even still, I'm not sure I understand the concern. If they go back and change something and resubmit, how is anything going to be wrong? They still submit the form again and will get a copy from the server. If they go back and change something, then just hit the forward button on the browser, they shouldn't expect consistent information because it never went back to the server.

So outside of something akin to the javascript button-disable mentioned above, I think you're SOL.

________________________________________
Andrew
 
Andrew,

I guess it's just me, but I hate to have someone look at the form and the values are not corrected due to changes they made by using the back or forward button. Even this site prevents cache when using firefox but it doesn't work in IE either.

Would you mind giving me the link to your site so I can see how it works in IE?

Again, thanks for your help - I sure appreciate it!

-Mike
 
Still in development, though it's scheduled for roll-out in about nine days. Assuming all goes well, next week Tuesday.

________________________________________
Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top