?
Solved

session expired problem!

Posted on 2004-09-06
2
Medium Priority
?
296 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Assisted Solution

by:Buz
Buz earned 300 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 700 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

719 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