Sessions -- more of an annoyance than a problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
oldtimer
Forum Contributor
Posts: 204
Joined: Sun Nov 03, 2002 8:21 pm
Location: Washington State

Sessions -- more of an annoyance than a problem

Post by oldtimer »

I am using sessions on some web pages and if you click on links no problem. Yet for awhile when you hit the back button you get
Warning: Page has Expired The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you.

To resubmit your information and view this Web page, click the Refresh button.
You hit refresh and you have to hit the retry button.

Any way around this? After several minutes or so this is not a problem.

On some pages there is nothing more then session_start(); so there is no information being passed from a form.
User avatar
qiangxd
Forum Newbie
Posts: 8
Joined: Thu Dec 05, 2002 6:00 pm

Post by qiangxd »

i have same problem. a friend told me to do it like this, you can give a try

Code: Select all

<?php
if(function_exists(session_cache_limiter)) { 

    session_cache_limiter("private, must-revalidate"); 
}
session_start()

?>
i have same problem. a friend told me to do it like this, you can give a try
oldtimer
Forum Contributor
Posts: 204
Joined: Sun Nov 03, 2002 8:21 pm
Location: Washington State

Post by oldtimer »

Your a life saver. Thanks that works great.

Jerry
JPlush76
Forum Regular
Posts: 819
Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:

Post by JPlush76 »

the best way is if you have access to your php.ini file

you can just go in there and change this line

; Set to {nocache,private,public} to determine HTTP caching aspects.
session.cache_limiter =


that way you dont have to include that code on all your pages :)
oldtimer
Forum Contributor
Posts: 204
Joined: Sun Nov 03, 2002 8:21 pm
Location: Washington State

Post by oldtimer »

So i change this

Code: Select all

; Set to &#123;nocache,private,public&#125; to determine HTTP caching aspects.
session.cache_limiter = nocache
to this ?

Code: Select all

; Set to &#123;nocache,private,public&#125; to determine HTTP caching aspects.
session.cache_limiter =
hedge
Forum Contributor
Posts: 234
Joined: Fri Aug 30, 2002 10:19 am
Location: Calgary, AB, Canada

Post by hedge »

Another method is to always end any response to a post with a Header command, usually back to the same page.
oldtimer
Forum Contributor
Posts: 204
Joined: Sun Nov 03, 2002 8:21 pm
Location: Washington State

Post by oldtimer »

When someone fills out a form i have redirects in place and I even have back links. But some people insist on using that back arrow button on their browser.

I tried the first responce and it worked. As this is my own web server I was able to go in thereafter and edit my php.ini and that worked as well.

Thanks all.
JPlush76
Forum Regular
Posts: 819
Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:

Post by JPlush76 »

oldtimer thats exactly right

give it a try :)
User avatar
riley
Forum Commoner
Posts: 45
Joined: Thu May 02, 2002 6:31 pm

Post by riley »

Not sure which is correct, bring up an old subject or start a new topic. In this case I chose to continue this link.

Using the cache_limiter it has stopped the problem of the expired page when clicking the back button but has created a problem with the refresh button. Now when the data changes the page does not refresh with the new information. If I go to another machine the updated data is available. The only way to get the new info. on the original machine using IE is to clear the history and/or delete temp files.

Anyway to accomplish both back and refresh. I've tried public, private, nocache.
Post Reply