Solved

session expired problem!

Posted on 2004-09-06
2
289 Views
Last Modified: 2013-12-12
OK i have some pages where customers can add products to there shopping cart.  After adding items to their cart the customer clicks on the link to their shopping cart, however when they click back on the browser to return to the previous page of the online store, then the browser displays "Warning: Page has expired" , i their is a problem with session variables being passed on Back commands.
0
Comment
Question by:kephillips
2 Comments
 
LVL 1

Assisted Solution

by:Buz
Buz earned 75 total points
ID: 11989664
It looks like pure html problem.

If you or the user are using the back option of the browser (or JavaScript) and the previous page is a result of a POST (adding a product to the cart for example) the browser will display the "Warning: Page has Expired" page since it expects the POST data and there is none.

There is no real solution for this problem but there is a workaround:
When the user clicks on 'add a product' this will call a script that will add the product to the session and redirect the user to another page. Somthing like product page >> add to cart submit script >> Confirmation page.

To check if I'm right try the next:
- Add a product to your cart
- Click on any link in your site (let's say an additional product but don't use 'add to cart')
- Click on 'view shopping cart' link
- Hit the back in your browser
If I'm right, you won't see the "Warning: Page has Expired" but the last page you asked for.

Good Luck,
B.
0
 
LVL 27

Accepted Solution

by:
Diablo84 earned 175 total points
ID: 11990388
This is a bug with Internet Explorer that happens when using sessions.

Add:

header("Cache-control: private");

after session_start(); on your form page
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
php mail headers 2 13
uploading multiple image with php 14 20
Wordpress Body Class 5 13
two tables one button 11 19
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now