Unique Session

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
phpcoder
Forum Contributor
Posts: 158
Joined: Sat Nov 02, 2002 1:18 pm
Location: Manchester, UK

Unique Session

Post by phpcoder »

Hi,
What is the best way of creating a unique session Id. I am creating a shopping cart but on that shopping cart user dont have to get register to buy anything so ther is no user name.

Thanks
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

You could just use the PHP session id itself.
(#10850)
User avatar
louie35
Forum Contributor
Posts: 144
Joined: Fri Jan 26, 2007 8:40 am
Location: Dublin
Contact:

Post by louie35 »

if you are going to use session just make sure the user accepts them first then do the cart thing.

set a session, then try to read it back.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

louie35 wrote:if you are going to use session just make sure the user accepts them first then do the cart thing.

set a session, then try to read it back.
Sorry, I can't quite follow your logic. When PHP starts a session, as aborint mentions, it automatically creates a unique session ID. See http://www.php.net/session and session_start()
Post Reply