CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Bookstore Based on IP Address

Print topic Send  topic

Author Message
Joseph
Posted: 05/27/2002, 3:12 PM

I need to make the bookstore application fill-in the shopping cart without the purchaser first filling-out the application form. How would I make the shopping cart based on the IP address rather than the member ID?

Nicole
Posted: 05/28/2002, 12:47 AM

Joseph,
use IP address instead UserID value in "orders" table.
While adding new record to shopping cart store user IP in proper field. Set field type to Hidden and in Before Insert assign its a value using code:
ASP
fldIP=Request.ServerVariables("REMOTE_ADDR")

After user log in you could catch his IP again and update orders table in order to fill member_id field with session variable value.
Raxip
Posted: 05/28/2002, 8:37 AM

You realize that if someone is behind a proxy then they all seem to be coming from the same ip.
Thought this might help
Joseph
Posted: 05/28/2002, 1:04 PM

Thanks to the both of you for your input. Sounds as if using the IP address could be a problem if behind proxy server. How do the majority of shopping carts allow you to first fill your cart and then check-out then??? Could you use cookies??

Thanks again for the help.

Sinerely,

Joseph
Brent
Posted: 05/28/2002, 6:52 PM

Using an IP address alone won't be unique enough. Several people on a dial up
to the same ISP will likely have the same IP address. This would mix up
their orders and the last one checking out pays for everyone's order. :(

If you store the shopping cart data as a session variable, then it should be
fine. Your session variable memory is unique to that user. Keep in mind that
you can store arrays as a session variable, and PHP can have an array as an
array element (an array of arrays). So you can put the purchases into an array
quite easily, and another session variable could be the customer address etc..
When the user completes the order, write it out to the database in a transaction.
Most PHP books show you how to do a shopping cart with PHP's session variables.
Check out "PHP and MySQL Web Development" by Luke Welling & Laura Thompson.

Of course remember to clear the session info if the user logs out or the session
times out. You don't want their credit card info lying around 30 minutes after they've
gone.

Brent


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.