General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 6th, 2003, 01:19 PM
amnesiac amnesiac is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 1 amnesiac User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Persistent shopping cart help

Hello,

I have a question about the persistent shopping cart tutorial.
Is there a way to give the user a new session id?

I hope you can help me with this.

the code for the creation of the cartId =
PHP Code:
function GetCartId() 



if(isset(
$_COOKIE["cartId"])) 

return 
$_COOKIE["cartId"]; 

else 


session_start(); 
setcookie("cartId"session_id(), time() + ((3600 24) * 30)); 
return 
session_id(); 




i have already tried to destroy the cookie and set a new one using the function above, but it wont work.

Thnx in advance

Reply With Quote
  #2  
Old October 6th, 2003, 05:51 PM
mattp23 mattp23 is offline
Moderated
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: UK
Posts: 82 mattp23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 43 m 44 sec
Reputation Power: 5
I dont know you indiviual situation but remember to get sessions to work the code 'session_start();' must be at the top of every page you want sessions to work on, before *anything* is output to the screen, having this half way down a function maynot be a good idea.
The code you have above does not do anything with sessions, except start one (it doesn't set any session variables or data, or read any)
to set session data try:
PHP Code:
 session_register('first_name');
$_SESSION['first_name'] = $first_name

for example

to stop sessions use: session_destroy();

note setcookie() is to do with cookies not sessions, this may be covered by the tutorial but i dont know

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Persistent shopping cart help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway