about axpiry of sessions

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
bugthefixer
Forum Contributor
Posts: 118
Joined: Mon Mar 22, 2004 2:35 am

about axpiry of sessions

Post by bugthefixer »

how do i know whether session has expires so that i can do something else rather then showing a message displaying that session has been expired.

actually i want to refresh page if the session has expired. anybody can tell me how can i do that.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

the session normally won't expire until the browser is closed..
bugthefixer
Forum Contributor
Posts: 118
Joined: Mon Mar 22, 2004 2:35 am

Post by bugthefixer »

but i get this information.

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.


and it happens due to sessions
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

No it doesn't. It happens due to you hitting the back button on your browser and trying to refresh it when $_POST data has already been sent.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

that's due to the page content being derived from a form post.
bugthefixer
Forum Contributor
Posts: 118
Joined: Mon Mar 22, 2004 2:35 am

Post by bugthefixer »

so is there anyway to find out that page is not displayed rather its expired
i want to do it so that page should refresh automatically when it is expired.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you set the expiration.. so uh.. you could add a meta-refresh..
bugthefixer
Forum Contributor
Posts: 118
Joined: Mon Mar 22, 2004 2:35 am

Post by bugthefixer »

can u help me in code

Code: Select all

header("refresh: ");
wat shud i write after 'refresh:' and where shud i place it in the page.
and dont u think it will always refresh the page and page will never be displayed.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you need an in-page refresh.. not a header refresh...

Code: Select all

<head>
<meta http-equiv="refresh" content="180" />
</head>
bugthefixer
Forum Contributor
Posts: 118
Joined: Mon Mar 22, 2004 2:35 am

Post by bugthefixer »

but i think it will refresh after every 180 seconds but i want to refresh it only once.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

then you'll have to script it to only run once.. have fun..
hedge
Forum Contributor
Posts: 234
Joined: Fri Aug 30, 2002 10:19 am
Location: Calgary, AB, Canada

Post by hedge »

bugthefixer wrote:but i get this information.

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.


and it happens due to sessions
The only way I've found to elmininate this problem is to have the script that receives the POST data not respond directly to the browser.. I have the script do it's work and then at the bottom it sends a header("location...") to the browser.

Kinda hard to explain.

1. enter page via GET: build page
2. enter page via POST: make db changes, then do a header back to php_self

this seems to break the POST/response and get rid of the browser refresh issue.
Post Reply