Re: Good morning!!!!!!

From: Date: Tue, 16 Oct 2001 10:35:12 +0000
Subject: Re: Good morning!!!!!!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-71189@lists.php.net to get a copy of this message
Balaji, In addition to the scoping issue that Tim Ward mentioned, you might want to check your logic. You'll get the "good" message if _either_ the "user" or "pw" session variables are set. You might want to see the "good" message only if _both_ are set, in which case you would want to use something like: if (!isset($HTTP_SESSION_VARS["user"]) || !isset($HTTP_SESSION_VARS["pw"])) or if (!(isset($HTTP_SESSION_VARS["user"]) && isset($HTTP_SESSION_VARS["pw"]))) Note the location of the exclamation points, logical operators, and parentheses. __________ Curt A. Gilman Richmond, Virginia "Balaji Ankem" <balaji.ankem@wipro.com> wrote in message news:00c301c15602$98056be0$1702910a@wipro.com... > > > > 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

« previous php.general (#71189) next »