473,513 Members | 2,558 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session or cookies

I have written a shopping cart type web application using session variables
to store the shopping cart details (with a timeout of 59 minutes).
Originally my timeout was set to the default 20 minute timeout, but I was
finding that people could take longer than 20 minutes between pages. So my
question is, what are peoples recommendations here, should I continue using
the session variables or should I adopt a cookie approach and store shopping
cart details locally, or something else completely different.

Thanks in advance.
Nov 19 '05 #1
7 1618
It depends on your needs. If an hour timeout works for you, then that's
great.

The other good thing about cookies, is that even if users close the browser
and go back to the site later, whatever was in their shopping cart will
still be there.

"Joseph Byrns" <jo*********@nnoossppaamm-yahoo.com> wrote in message
news:uv**************@TK2MSFTNGP15.phx.gbl...
I have written a shopping cart type web application using session variables
to store the shopping cart details (with a timeout of 59 minutes).
Originally my timeout was set to the default 20 minute timeout, but I was
finding that people could take longer than 20 minutes between pages. So my
question is, what are peoples recommendations here, should I continue using
the session variables or should I adopt a cookie approach and store
shopping cart details locally, or something else completely different.

Thanks in advance.

Nov 19 '05 #2
And do you find that an hour timeout is generally adequate for your
applications?

Thanks.

"Marina" <so*****@nospam.com> wrote in message
news:eV**************@TK2MSFTNGP14.phx.gbl...
It depends on your needs. If an hour timeout works for you, then that's
great.

The other good thing about cookies, is that even if users close the
browser and go back to the site later, whatever was in their shopping cart
will still be there.

"Joseph Byrns" <jo*********@nnoossppaamm-yahoo.com> wrote in message
news:uv**************@TK2MSFTNGP15.phx.gbl...
I have written a shopping cart type web application using session
variables to store the shopping cart details (with a timeout of 59
minutes). Originally my timeout was set to the default 20 minute timeout,
but I was finding that people could take longer than 20 minutes between
pages. So my question is, what are peoples recommendations here, should I
continue using the session variables or should I adopt a cookie approach
and store shopping cart details locally, or something else completely
different.

Thanks in advance.


Nov 19 '05 #3
I think it really depends on the application. Sometimes session timeouts are
just unacceptable, and you need to find an alternate way.

I would say for a shopping cart, you really don't want session timeouts. I
know when I use online shopping apps, I would be annoyed if it kept timing
out for whatever reason.

Wrap all your user information access/retrieval code in some functions. That
way, if you ever decide to switch the way you store user information, you
only need to change the code inside those methods.

"Joseph Byrns" <jo*********@nnoossppaamm-yahoo.com> wrote in message
news:OU**************@tk2msftngp13.phx.gbl...
And do you find that an hour timeout is generally adequate for your
applications?

Thanks.

"Marina" <so*****@nospam.com> wrote in message
news:eV**************@TK2MSFTNGP14.phx.gbl...
It depends on your needs. If an hour timeout works for you, then that's
great.

The other good thing about cookies, is that even if users close the
browser and go back to the site later, whatever was in their shopping
cart will still be there.

"Joseph Byrns" <jo*********@nnoossppaamm-yahoo.com> wrote in message
news:uv**************@TK2MSFTNGP15.phx.gbl...
I have written a shopping cart type web application using session
variables to store the shopping cart details (with a timeout of 59
minutes). Originally my timeout was set to the default 20 minute timeout,
but I was finding that people could take longer than 20 minutes between
pages. So my question is, what are peoples recommendations here, should
I continue using the session variables or should I adopt a cookie
approach and store shopping cart details locally, or something else
completely different.

Thanks in advance.



Nov 19 '05 #4
Joseph Byrns wrote:
I have written a shopping cart type web application using session variables
to store the shopping cart details (with a timeout of 59 minutes).
Originally my timeout was set to the default 20 minute timeout, but I was
finding that people could take longer than 20 minutes between pages. So my
question is, what are peoples recommendations here, should I continue using
the session variables or should I adopt a cookie approach and store shopping
cart details locally, or something else completely different.

Thanks in advance.


I don't think it's a good idea to store a whole shopping cart in cookies.
What you *can* do however is make your own "sessions": store just a
shopping cart ID in a cookie, and store the whole cart in the database
(under that same ID).

--
Hans Kesting
Nov 19 '05 #5
i agree, i expect my cart to last days. you should store the cart info in a
database with maybe a 30 day purge, and store the cart id in a cookie.

-- bruce (sqlwork.com)
"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:eX**************@TK2MSFTNGP14.phx.gbl...
| Joseph Byrns wrote:
| > I have written a shopping cart type web application using session
variables
| > to store the shopping cart details (with a timeout of 59 minutes).
| > Originally my timeout was set to the default 20 minute timeout, but I
was
| > finding that people could take longer than 20 minutes between pages. So
my
| > question is, what are peoples recommendations here, should I continue
using
| > the session variables or should I adopt a cookie approach and store
shopping
| > cart details locally, or something else completely different.
| >
| > Thanks in advance.
| >
| >
|
| I don't think it's a good idea to store a whole shopping cart in cookies.
| What you *can* do however is make your own "sessions": store just a
| shopping cart ID in a cookie, and store the whole cart in the database
| (under that same ID).
|
| --
| Hans Kesting
Nov 19 '05 #6

"Joseph Byrns" <jo*********@nnoossppaamm-yahoo.com> wrote in message
news:uv**************@TK2MSFTNGP15.phx.gbl...
I have written a shopping cart type web application using session variables to store the shopping cart details (with a timeout of 59 minutes).
Originally my timeout was set to the default 20 minute timeout, but I was
finding that people could take longer than 20 minutes between pages. So my question is, what are peoples recommendations here, should I continue using the session variables or should I adopt a cookie approach and store shopping cart details locally, or something else completely different.

Thanks in advance.

I have found the people come back the next day or so on some occasions. I
store a cart ID in a cookie and store the cart information in a database.
The cookie expires after so many days. I have had people come back after the
expiration and complain that someone took something out of their cart! You
do have handle price changes and out of stock merchandise though using this
method.
just my 2 cents
Mike
Nov 19 '05 #7
>You do have handle price changes and out of stock merchandise though
using this
method.


Not necessarily. The way I have done this is to have the cookie store
the basket ID, then the basket contents in a database. But ... the
basket contents in the database were basically only a list of product
IDs and quantities. That way if prices change, you don't have to worry
about it. When displaying the basket, you just show the product details
from the products table.

--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
7086
by: mrbog | last post by:
Tell me if my assertion is wrong here: The only way to prevent session hijacking is to NEVER store authentication information (such as name/password) in the session. Well, to never authenticate...
0
14665
by: Maverick | last post by:
Hello all, I read some good reviews about jakarta HTTPClient about its session and cookies management system and fancied giving it a try as a learning exercise but somehow I don't seem to be able...
3
3535
by: PM | last post by:
I'm trying to make a kind of search history containing the 3 last searched words. So I'm using 3 Session Variables: Word1 / Word2 / Word3. In order to get this history working, I need to put the...
2
3324
by: Amit D.Shinde | last post by:
Hello Experts.. I need some help regarding cookies and session objects and also global.asa file I am creating one cookie when a user logs in on my website. The cookie stores the login name of...
9
1951
by: RA | last post by:
Hi Please review and let me know if I am correct: 1) My understanding from reading http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/ diforwc-ch05.asp is that...
7
1987
by: Marcus | last post by:
I know that when you start a session in PHP, the "cookie" it creates is not the same as those that are stored in your browser's temp folder, and instead is kept in RAM. I am confused because in...
3
4906
by: damezumari | last post by:
To find out were session variables are stored I included this instruction in my program: echo ini_get("session.save_path"); The reply was /home/7604/data/tmp which is a folder on my server. I...
2
4994
by: StanB | last post by:
I came across this weird problem: 1. Session state stops working after the app is deployed to another server because IE does not accept cookies. 2. It works if cookieless="true" in the...
3
4982
by: dihola | last post by:
Hi, I have a website running in IIS7 and it seems to be creating a new session for every request I make. The values I store in Session are lost with every request. This is the forms bit in my...
9
7778
by: Josh | last post by:
I run a Joomla website and am familiar with php in some but not all aspects. Currently I am trying to find some solutions related to session handling. Am I correct in saying that "login" is kept...
0
7260
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7161
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7101
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7525
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5686
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5089
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
1596
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.