Need to build an online shopping cart in a hurry? This articletakes a look at session management, an important component oftransaction-based Web sites, and explains the fundamentals of addingsession support to your site. Examples in PHP4 and PHP3 with PHPLib.
Psychiatrist: So, how are we feeling today, Victor?
Patient: Not too good, Doc. I've been feeling a little blue lately...
Psychiatrist: And why is that, Victor?
Patient: I don't know, Doc. I haven't been sleeping too well, and I can't seem to work up an appetite at all. We went to an Italian restaurant the other day and ordered pasta - but when they brought it to the table, I couldn't bring myself to eat it. I just stared at it, with the theme song to "The Sopranos" playing over and over in my head...
Psychiatrist: How's the family?
Patient: Doing OK, I think. Marge spends most of her time in the kitchen, trying out recipes she's downloaded off the Web. And the kids are out of the house all the time - earlier, we used to see them at mealtimes, but now they've started eating at Burger King. Can't say I blame them, either.
Psychiatrist: And work - everything good there?
Patient: Not really - I've got this sadistic monster of a boss, and he seems determined to turn my life into the Dilbert Zone!
Psychiatrist: Tell me a little more about him.
Patient: Well, you know what I do - I'm a Web programmer over at Used Socks, Inc. Our new Web site is going live next week, and we're doing something completely unique - an online store for people to put up their used socks for sale. We've even got some angel investment - six million dollars, with more to come if we become the Web's most popular used socks portal.
Psychiatrist: Sounds like things are going well for you.
Patient: Yeah, you'd think. But then the boss came in the other day, and said that he was assigning me the responsibility of developing the online shopping cart. And he specifically wanted me to use something called "sessions". And, of course, just to make things interesting, he said that he wanted it up and running in two days...the sadistic little freak!
Psychiatrist: Is that a problem?
Patient: Yup, especially since I don't know the first thing about what a "session" is, or how to go about using one. I mean, I thought a session is something a shrink does with a patient - kinda like what we're doing right now.
Psychiatrist: Oh, Victor, Victor...is that all that's bothering you? I think I have something that might help...