[PHP] Verify session in function

2001-03-05 Thread Tobias Talltorp

I am building my first basic function to verify a session.
If the verification is not in the function it works...
What am I missing?
(I couldnĀ“t find anything about this in the mailing list archive)

-- This works --
session_start();

   if (isset($PHPSESSID)){
echo "ok";
} else

echo "not ok";
}


-- This does not work -
session_start();
verifySess();

function verifySess() {
if (isset($PHPSESSID)){
echo "ok";
} else

echo "not ok";
}
  }

Thanks,
// Tobias





-- 
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] Verify session in function

2001-03-05 Thread kaab kaoutar


U just have to add global $PHPSESSID
to make the session variable global;

From: "Tobias Talltorp" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP] Verify session in function
Date: Mon, 5 Mar 2001 18:30:00 +0100

I am building my first basic function to verify a session.
If the verification is not in the function it works...
What am I missing?
(I couldnĀ“t find anything about this in the mailing list archive)

-- This works --
session_start();

if (isset($PHPSESSID)){
 echo "ok";
 } else

 echo "not ok";
 }


-- This does not work -
session_start();
verifySess();

function verifySess() {
 if (isset($PHPSESSID)){
 echo "ok";
 } else

 echo "not ok";
 }
   }

Thanks,
// Tobias





--
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]


_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


-- 
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]