[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-WebCGI] shopping cart



At 12:31 AM -0500 11/8/99, RAZVAN C NICULITA wrote:
Hi,
I want to develop a shopping cart, but I have run ito some real problems.
I wonder how to test that the "sessionID" value is valid when a user who has
bookmarked a page returns to the website using that bookmark.
The bookmark look like this:
"http://www.myserver.com/samplefile?sessionID=xxxx".
My problem is that sessionID coresponds with the order number and if the
user is not assigned a new sessionID he will end up corrupting his previous
order.

Anybody has a solution?

Well, one strategy would be to split those roles apart. Then you can 
change one without changing the other
Try:
"http://www.myserver.com/samplefile?sessionID=xxxx&order_num=nnnn"

or

make your querystring a two-part string 'xxxx.nnnn', which your 
script can parse into session id and order number for separate usage 
or processing:

#!perl -wl

$query_string = 'abcd.12345'; #this value comes to your script
($id,$num) = split(/\./, $query_string);	# one way to parse
# What'd we get?
print 'Session ID = ', $id;
print 'Order Number = ', ++$num;  # increment the order number

__END__
prints:

Session ID = abcd
Order Number = 12346

###


But this is really a data management question. How long will you let 
someone 'come back' based on bookmarking an initial session? If you 
really want to allow a user to return and generate a new transaction 
under that original identifier, then user id must be separated from 
order number. And if the user may leave and return before completing 
a particular transaction, then you might need a session id separate 
from user id and order number.


- Bruce

__Bruce_Van_Allen___bva@cruzio.com__831_429_1688_V__
__PO_Box_839__Santa_Cruz_CA__95061__831_426_2474_W__


==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org