Re: using require or include?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reinhart Viane wrote:
i have made a page (overall.php) in which several elements are defined:
the connection with the database
a function called session_checker to check if users are logged in
and a last function(function getuserinfo()) that substracts values from
the database based on the session variables of the logged in user
Now this last function sets 2 variables eg.
$username=$row['user_name'];
$userstatus=$row['user_status'];
like this i do not have to recall this script on every page but i just
can do the function at the top of every page
Now on every page of my site I require this file
require(overall.php);
But it seems that i cannot get the variables outta this file.
So i can not use $username or $userstatus on the pages.
I think it has something to do with require not passing the variables?
Off course i can repeat the function script on the top of every page,
but that's stupid i think.
Can i use a include without any problems? Or is there a significant
difference in use and security?
<snip>

Scope.

http://us4.php.net/manual/en/language.variables.scope.php

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux