News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Global Variables Across Classes

Started by ziycon, March 02, 2012, 05:13:14 AM

Previous topic - Next topic

ziycon

I'm trying to use a global variable across multiple classes, for example one class has:
global $logged_in;

if($logged_in)
  //your logged in
else
  //your not logged in


Then in the login class I have the below code:
global $logged_in;

if(//details are valid)
  $logged_in = true;
else
  $logged_in = false;


False always works but the 'true' value isn't being picked up even when set yo true!?

Any help greatly appreciated.

Advertisement: