passing Variables with require
Posted: Fri Feb 23, 2007 11:14 am
Hi there,
I've just started trying to write my login script with Sessions (a different issue!), however I've put the function to check for login in a seperate php file called functions.php
In this file I write to a variable like this:
$loggedIn = true;
The php file is used in, for example, index.php using
require 'functions.php';
I can call the methods of the functions.php file, however index.php does not seem to see the $loggedIn variable.
Are variables not passed in with the require construct? How would I recode such that I can set the variable in the functions.php file and then just access is from the other php files?
Thanks in advance
Regards
Stu
I've just started trying to write my login script with Sessions (a different issue!), however I've put the function to check for login in a seperate php file called functions.php
In this file I write to a variable like this:
$loggedIn = true;
The php file is used in, for example, index.php using
require 'functions.php';
I can call the methods of the functions.php file, however index.php does not seem to see the $loggedIn variable.
Are variables not passed in with the require construct? How would I recode such that I can set the variable in the functions.php file and then just access is from the other php files?
Thanks in advance
Regards
Stu