954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

$_SESSION[''] - Handling for webshop ?

Hi all,

I came to think of something in my code, which might cause a problem, but I am not sure.

After a user of the site has succesfully put a product in the shopping cart - I set a session['cart_succes'] = 'something'; - to display to the customer (after I have used headers to redirect to another page, and avoid to add extra products if the user refreshes the page.)

How does sessions work, if lets say - there is another customer on the webpage. If he/she browses to same same page as another customer has just been to, and the session hasent been unset yet - will the new customer then see the: session['cart_succes'] = 'something'; when visiting the page, but without having put anything into the shopping cart yet?

Or is the session only set on the specific customers client/or session??

I hope I have explained so it can be understood outside my head.

/Klemme

klemme
Posting Whiz in Training
265 posts since Mar 2011
Reputation Points: 18
Solved Threads: 7
 

A session is specific to a browser. So if one user is on your website with IE and Opera, then they both have a different session. Same thing for a different user on a different machine.

pritaeas
Posting Expert
Moderator
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

Thanks pritaeas! It wouldnt be very customer friendly to spit out success messages to everyone when they havent bought anything :-)

So its a good thing to know - I wasnt sure if it was on the server, and displayed generally for everyone one the site.

klemme
Posting Whiz in Training
265 posts since Mar 2011
Reputation Points: 18
Solved Threads: 7
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: