You only have to register the session variables once.  If you need to register the 
same variables again (such as for a different user), then you should use 
session_destroy() before registering the variables again.

The variables should be available throughout your pages as long as session_start() is 
done before ANY output goes to the HTML.  It's usually best to have it as the FIRST 
thing on your pages.

Martin

>>> <[EMAIL PROTECTED]> 07/08/02 04:19PM >>>
/me feels kinda dumb now.

Well even after adding session_start to my connect.inc, it doesn't work. I 
only need to do session_register() once correct?  Or do I need to do that 
everytime I do session start?  If I have to do it everytime then what is 
the point of sessions?

Jed






"Kevin Stone" <[EMAIL PROTECTED]>
07/08/2002 02:12 PM

 
        To:     <[EMAIL PROTECTED]>, <[EMAIL PROTECTED] 
        cc: 
        Subject:        Re: [PHP] UNSETing Session Variables


I fear you're missing something fundemental here.  The active session 
needs to be requested for each script.  So session_start() needs to be 
called at the top of each script (or at least before any output). 
Example..
 
page 1
----------
<?
session_start();
$myvar = "foo bar";
session_register('myvar');
// or //
$_SESSION['myvar'] = $myvar;
?>
 
page 2
---------
<?
session_start();
unset($_SESSION['myvar'];
// or //
session_unregister('myvar');
?>
 
----- Original Message ----- 
From: [EMAIL PROTECTED] 
To: Kevin Stone 
Cc: [EMAIL PROTECTED] ; [EMAIL PROTECTED] 
Sent: Monday, July 08, 2002 2:05 PM
Subject: Re: [PHP] UNSETing Session Variables


Sorry about that I should have been more detailed. 
session_start() and all of my session_register() calls happen on login.php 
here is a sample session_register call. 
  session_register("currentbid"); 
I am under the impression that I only need one session register call. 

Jed 




"Kevin Stone" <[EMAIL PROTECTED]> 
07/08/2002 02:00 PM 
        
        To:        <[EMAIL PROTECTED]> 
        cc:        <[EMAIL PROTECTED]> 
        Subject:        Re: [PHP] UNSETing Session Variables



$_SESSION['currentbid'] isn't available until you do session_start(); 
  
session_start(); 
unset($_SESSION['currentbid']); 
  
Or is this what does connect.inc contains? 
  
-Kevin 
 
----- Original Message ----- 
*snip 
  please see previous messages for this information 
 snip* 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to