RE: [PHP] Re: correct session format?

From: Date: Wed, 16 Jul 2003 22:46:20 +0000
Subject: RE: [PHP] Re: correct session format?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-155504@lists.php.net to get a copy of this message
--On Monday, June 23, 2003 08:30:19 AM -0600 "Johnson, Kirk" <kjohnson@zootweb.com> wrote:
So what is the diffirent between :
session_start (); $_SESSION['eventid'] = 'arma2';
and
session_start (); session_register('arama2');
Use the first method to create session variables when register_globals is "off" in the php.ini file. Use the second method when it is "On". http://www.php.net/session Kirk
First, there is a bit of a coding error here. The two examples should be: session_start (); $_SESSION['eventid'] = 'arma2'; and session_start (); session_register('eventid'); Second, the documentation indicates that if you turn off register globals you must us the super global $_SESSION[]. But, it later says that $_SESSION[] and session_register() set the same values. (It does talk about a problem with this in 4.2.3 that is fixed in 4.3) My question is what is the effect of mixing these two techniques. For example with register globals off should: session_start (); session_register('eventid'); $_SESSION['eventid'] = 'foo'; Does the session_register() hurt? What is the interaction? The larger question for us a PRIDE is we have quite a bit of code that assumes register globals is on and we are doing new development where we would like to the the super global $_SESSION[] support instead of the older techniques. What are the consequences of mixing the two techniques? Thanks in advance, Bill +----------------------------------------------- | Bill MacAllister | Senior Programmer, Pride Industries | 10030 Foothills Blvd., Roseville CA 95747
| Phone: +1 916.788.2402    Fax: +1 916.788-2540


« previous php.general (#155504) next »