session destroy and unset

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
loongest
Forum Commoner
Posts: 25
Joined: Wed Apr 07, 2004 12:23 pm

session destroy and unset

Post by loongest »

<?php

session_name();
session_start("customerid");
session_start("firstname");
session_start("lastname");

if(!(session_is_registered("customerid")))
{
session_unset();
session_destroy();

session_start("guest");
$guest = "Guest";
session_register("guest");

}

how can i destroy the session only for the guest ? but not customerid ?
or once the session_unset() and session_destroy() is call all the session variable will lost?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

well.. if you took the time to look at the manual for session_start() you'd notice that it doesn't take any arguments.

the bible
loongest
Forum Commoner
Posts: 25
Joined: Wed Apr 07, 2004 12:23 pm

Post by loongest »

but the session_start("customerid") that i follow from the book....
it's take arguments
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

There is no point to it at all.. session_start() starts the session

if you want to get rid of a specific session var than do this

$_SESSION["foobar"] = array();
Post Reply