RE: Good morning!!!!!!

From: Date: Tue, 16 Oct 2001 07:59:38 +0000
Subject: RE: Good morning!!!!!!
Groups: php.general 
Request: Send a blank email to php-general+get-71185@lists.php.net to get a copy of this message
Scoping. I would expect you to need GLOBAL $HTTP_SESSION_VARS inside the function. This still catches me out. Environmental variables have the same scoping limitations as your own. Tim Ward ---------- From: Balaji Ankem [SMTP:balaji.ankem@wipro.com] Sent: 16 October 2001 06:23 To: php-general@lists.php.net Subject: Good morning!!!!!! Hi! friend, see the following..what will be the output?? Here i am calling example.php in php file after starting a session.. example.php ------------------ <?php if (!isset($HTTP_SESSION_VARS["user"]) && !isset($HTTP_SESSION_VARS["pw"])) { header("Location:secure.php"); } ?> ----------------------- secure.php ------------------------------ <?php require("secure_connection.php"); // required function is in this file session_authentication(); file://function call ?> ------------------------------ secure_connection.php --------------------------------- <?php function session_authentication() { session_start(); if (!isset($HTTP_SESSION_VARS["user"]) && !isset($HTTP_SESSION_VARS["pw"])) { session_destroy(); echo "Bad I am not expecting this output"; } else { echo "good expected output"; } } ?> ------------------------------------ I am expecting "good expected output"..but itz displaying the otherone.(Bad i am not expecting this output). Instead of function call if i execute the code which is written in the function then itz displaying the "good expected output".. what z wrong with me?? Thanks and regards -Balaji <<File: Wipro_Disclaimer.txt>>

« previous php.general (#71185) next »