RE: [PHP] I don't understand HTTP_SESSION_VARS

2001-03-26 Thread Michael Champagne

Hi Kirk,
I'm not sure that's how it is supposed to work.  I really think that this is
a PHP bug.  I had to turn register globals back on in order to get my code
working again.  I thought you're supposed to be able to simply declare a
variable, do a session_register on it, and then access it on subsequent
pages using $HTTP_SESSION_VARS.  I'm going to keep register globals on for
now I think.  Thanks for your help!

Mike

 Mike, my experiments suggest you can also get rid of the session_register()
 statement. Seems that simply assigning to $HTTP_SESSION_VARS[my_session_var]
 is enough.

 Kirk


  -Original Message-
  From: Michael Champagne [mailto:[EMAIL PROTECTED]]
  Subject: RE: [PHP] I don't understand HTTP_SESSION_VARS
 
 
  YES!  That's what it was.  You rule man.  Why would
  session_start need to come
  before the global variable declaration?  You'd think
  session_start would need
  $HTTP_SESSION_VARS declared beforehand to load the session
  variables into?
 
  Thanks,
  Mike
 
   OK, try this. The session_start() has to come before the
  global statement:
  
   ?php
   function write_session()
   {
 session_start();
 global $HTTP_SESSION_VARS;
 $HTTP_SESSION_VARS[my_session_var] = "Boogedy Boogedy";
 session_register($HTTP_SESSION_VARS["my_session_var"]);
   }
  
   write_session();
   echo $HTTP_SESSION_VARS['my_session_var'];
   ?



-- 
Michael Champagne, Software Engineer
Capital Institutional Services, Inc.
wk: [EMAIL PROTECTED]
hm: [EMAIL PROTECTED]



**
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.
**

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] I don't understand HTTP_SESSION_VARS

2001-03-23 Thread hi

Hi,

The php manual at: http://www.php.net/manual/en/ref.session.php
says:

"If track_vars is enabled and register_globals is disabled, only members of
the global associative array $HTTP_SESSION_VARS can be registered as session
variables. "

so, did you try this:

session_register($HTTP_SESSION_VARS["my_session_var"];




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] I don't understand HTTP_SESSION_VARS

2001-03-23 Thread Michael Champagne

I tried this and could not get this working either.  Does anyone know which is
the best way to do it?  What are the pros and cons of doing this with
track_vars or as globals?

Thanks,
Mike

 Hi,

 The php manual at: http://www.php.net/manual/en/ref.session.php
 says:

 "If track_vars is enabled and register_globals is disabled, only members of
 the global associative array $HTTP_SESSION_VARS can be registered as session
 variables. "

 so, did you try this:

 session_register($HTTP_SESSION_VARS["my_session_var"];






-- 
Michael Champagne, Software Engineer
Capital Institutional Services, Inc.
wk: [EMAIL PROTECTED]
hm: [EMAIL PROTECTED]



**
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.
**

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] I don't understand HTTP_SESSION_VARS

2001-03-23 Thread Johnson, Kirk

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:[EMAIL PROTECTED]]
 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] I don't understand HTTP_SESSION_VARS

2001-03-23 Thread hi

Hi,

That code causes php to crash.  I have never had that happen before.  Every
time I try to run that script, I am given an internal server warning.

""Johnson, Kirk"" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 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:[EMAIL PROTECTED]]
  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

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] I don't understand HTTP_SESSION_VARS

2001-03-23 Thread Michael Champagne

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:[EMAIL PROTECTED]]
  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: [EMAIL PROTECTED]
hm: [EMAIL PROTECTED]



**
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.
**

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] I don't understand HTTP_SESSION_VARS

2001-03-23 Thread hi

Also, you are registering a variable rather than a name.  So, unless there
is a quoted name for the variable value, I don't think that would work.  For
instance,

$a="b"
session_register($a);

actually registers a variable called $b.  I made that mistake in my post
too.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] I don't understand HTTP_SESSION_VARS

2001-03-23 Thread Michael Champagne

Maybe I should just go back to using globals then.  What does everyone else do
normally?  Globals or use the track_vars?  I can't get these things working at
all.

Mike

 Hi,

 That code causes php to crash.  I have never had that happen before.  Every
 time I try to run that script, I am given an internal server warning.

 ""Johnson, Kirk"" [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  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:[EMAIL PROTECTED]]
   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
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 





-- 
Michael Champagne, Software Engineer
Capital Institutional Services, Inc.
wk: [EMAIL PROTECTED]
hm: [EMAIL PROTECTED]



**
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.
**

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] I don't understand HTTP_SESSION_VARS

2001-03-23 Thread Michael Champagne

I tried quoting it as well - my last post is where I'm currently at with this.
Still doesn't work, but doesn't crash anything either.

Mike

 Also, you are registering a variable rather than a name.  So, unless there
 is a quoted name for the variable value, I don't think that would work.  For
 instance,

 $a="b"
 session_register($a);

 actually registers a variable called $b.  I made that mistake in my post
 too.






-- 
Michael Champagne, Software Engineer
Capital Institutional Services, Inc.
wk: [EMAIL PROTECTED]
hm: [EMAIL PROTECTED]



**
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.
**

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] I don't understand HTTP_SESSION_VARS

2001-03-23 Thread hi

Hi,

The default php setting is with track vars on, and register globals on I
believe.  I have never tried anything else.  I turned globals off to see if
I could help you with your problem.   If you check the manual, they do not
put much explanation into how to use sessions with globals off, though I
have read that some webservers may have globals turned off.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] I don't understand HTTP_SESSION_VARS

2001-03-23 Thread hi

Hi,

Go post your globals question at the php forum at www.devshed.com .  You
will usually get extremely quick responses to questions about php.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] I don't understand HTTP_SESSION_VARS

2001-03-23 Thread Johnson, Kirk

OK, try this. The session_start() has to come before the global statement:

?php
function write_session()
{
  session_start();
  global $HTTP_SESSION_VARS;
  $HTTP_SESSION_VARS[my_session_var] = "Boogedy Boogedy";
  session_register($HTTP_SESSION_VARS["my_session_var"]);
}

write_session();
echo $HTTP_SESSION_VARS['my_session_var'];
?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] I don't understand HTTP_SESSION_VARS

2001-03-23 Thread Michael Champagne

YES!  That's what it was.  You rule man.  Why would session_start need to come
before the global variable declaration?  You'd think session_start would need
$HTTP_SESSION_VARS declared beforehand to load the session variables into?

Thanks,
Mike

 OK, try this. The session_start() has to come before the global statement:

 ?php
 function write_session()
 {
   session_start();
   global $HTTP_SESSION_VARS;
   $HTTP_SESSION_VARS[my_session_var] = "Boogedy Boogedy";
   session_register($HTTP_SESSION_VARS["my_session_var"]);
 }

 write_session();
 echo $HTTP_SESSION_VARS['my_session_var'];
 ?



 **
 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.
 **


-- 
Michael Champagne, Software Engineer
Capital Institutional Services, Inc.
wk: [EMAIL PROTECTED]
hm: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] I don't understand HTTP_SESSION_VARS

2001-03-23 Thread Johnson, Kirk

Mike, my experiments suggest you can also get rid of the session_register()
statement. Seems that simply assigning to $HTTP_SESSION_VARS[my_session_var]
is enough.

Kirk


 -Original Message-
 From: Michael Champagne [mailto:[EMAIL PROTECTED]]
 Subject: RE: [PHP] I don't understand HTTP_SESSION_VARS
 
 
 YES!  That's what it was.  You rule man.  Why would 
 session_start need to come
 before the global variable declaration?  You'd think 
 session_start would need
 $HTTP_SESSION_VARS declared beforehand to load the session 
 variables into?
 
 Thanks,
 Mike
 
  OK, try this. The session_start() has to come before the 
 global statement:
 
  ?php
  function write_session()
  {
session_start();
global $HTTP_SESSION_VARS;
$HTTP_SESSION_VARS[my_session_var] = "Boogedy Boogedy";
session_register($HTTP_SESSION_VARS["my_session_var"]);
  }
 
  write_session();
  echo $HTTP_SESSION_VARS['my_session_var'];
  ? 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]