Customizing SMF > SMF Coding Discussion

Global Variables Across Classes

(1/1)

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

--- Code: ---global $logged_in;

if($logged_in)
  //your logged in
else
  //your not logged in
--- End code ---

Then in the login class I have the below code:

--- Code: ---global $logged_in;

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

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

Any help greatly appreciated.

Navigation

[0] Message Index

Go to full version