Questions Regarding Sessions - Mailing list pgsql-php

From Ludwig Lim
Subject Questions Regarding Sessions
Date
Msg-id 20030322050118.17564.qmail@web80411.mail.yahoo.com
Whole thread Raw
Responses Re: Questions Regarding Sessions
List pgsql-php
Hi:

I have the following small php files, t1.php and
t2.php

t1.php contains the ff:
<?
   function func1()
   {
       global $HTTP_SESSION_VARS;
       session_start();
       $HTTP_SESSION_VARS["test"]="hello";
       session_register($HTTP_SESSION_VARS["test"]);
   }
?>

t2.php contains the ff:
<?
     include("t1.php");

     func1();
     session_start();
     if
session_is_registered($HTTP_SESSION_VARS["test"]){
        echo ("Session is registerd <br>");
        $x = $HTTP_SESSION_VARS["test"];
        echo ("value of session = $x");
        session_destroy();
     }
?>

The output I am getting when loading t2.php is the ff:
Session is registered
value of session =

Instead of:
Session if registered
value of session = hello

   I've tried testing simple session scripts and it
works, but initializing and using sessions in a
function seems to be a problem for me.
   The session is registed, but the value of the
session variable is missing. The session is created
when I look at the /tmp directory and the the file
ses<session id>.
   How can I make the script above to work?

Some additional info:
   version : php 4
   important configuration = --enable-track-vars
--enable-trans-sid --with-apache=<directory>

Thank you very much,

ludwig.


__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com


pgsql-php by date:

Previous
From: apz
Date:
Subject: Re: manage stored files via web
Next
From: apz
Date:
Subject: Re: Questions Regarding Sessions