Re: I don't understand HTTP_SESSION_VARS

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: Re: I don't understand HTTP_SESSION_VARS
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-45345@lists.php.net to get a copy of this message
I'm trying this and it's still not working. Here is my code in 2 files, write_sess.php and read_sess.php. I've been trying to figure this out all day. /* WRITE_SESS.PHP */ <?php function write_session() { global $my_session_var, $HTTP_SESSION_VARS; session_start(); $my_session_var = "Boogedy Boogedy"; session_register($HTTP_SESSION_VARS['my_session_var']); } write_session(); ?> <HTML> <BODY> <a href = "read_sess.php"> Read Session Variable </a> </BODY> </HTML> /* READ_SESS.PHP */ <?php session_start(); ?> <HTML> <BODY> <?php function read_session() { global $HTTP_SESSION_VARS; return $HTTP_SESSION_VARS['my_session_var']; } print"Session Variable: ". read_session(); ?> </BODY> </HTML> Here is my php.ini file: /*** PHP Initialization File ***/ asp_tags=true include_path=.:/ora9ias/Apache/Apache/php auto_prepend_file=cisweb_global.inc session.gc_maxlifetime=14400 session.gc_probability=10 session.name=CIS_SECURE_SESSION register_globals off track_vars on I'm so confused why I can't get this working. Thanks for everyone's help. Mike > Try as below. Note both the global and the session_register statements. > > > function set session() > > { > > global $my_session_var,$HTTP_SESSION_VARS; > > session_start(); > > $my_session_var = "Blah blah"; > > session_register($HTTP_SESSION_VARS['my_session_var']); > > } > > Kirk > > > > -----Original Message----- > > From: Michael Champagne [mailto:mchampagne@capis.com] > > Sent: Friday, March 23, 2001 1:32 PM > > To: PHP General Mailing List > > Subject: [PHP] I don't understand HTTP_SESSION_VARS > > > > > > I'm still having problems with this. I was able to get > > sessions and session > > variables working ok with register_globals=on, but I had read > > that it was > > better not to keep register_globals on so I turned it off and > > I'm trying to > > figure out how this works now. > > > > I'm registering a variable in one function say like this: > > function set session() > > { > > global $my_session_var; > > session_start(); > > $my_session_var = "Blah blah"; > > session_register('my_session_var'); > > } > > > > Then I'm trying to read it in another function like this: > > function read_session() > > { > > global $HTTP_SESSION_VARS; > > session_start(); > > echo ($HTTP_SESSION_VARS[my_session_var]); > > } > > > Michael Champagne, Software Engineer > > -- Michael Champagne, Software Engineer Capital Institutional Services, Inc. wk: mchampagne@capis.com hm: mchamp@texas.net ****************************************************************** This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction, unless specifically agreed otherwise. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect the views or opinions of Capital Institutional Services, Inc. Capital Institutional Services, Inc. accepts no liability for any errors or omissions arising as a result of transmission. Use of this communication by other than intended recipients is prohibited. ******************************************************************

« previous php.general (#45345) next »