Matpatnik Posted February 2, 2007 Share Posted February 2, 2007 Hi guys,I got this code which is working fine in one part of the page on the other part it doesn't recognize me!in that page it can look like that:page1.php function adminRestriction() { global $a_maxsize, $a_master; $admin_sql = "SELECT * FROM administration"; $admin_result = mysql_query($admin_sql) or die("Invalid query: " . mysql_error()); $row = mysql_fetch_array($admin_result); $a_maxsize = $row['admin_maxupload']; $a_master = $row['admin_master'];}// this is where I allow the $a_masterinclude "page2.php"; page2.php // only html code except the includeinclude "page3.php"; page3.php // only html code except this <?phpadminRestriction();if ($_SESSION['user_logged'] == $a_master) { echo $admin_master;} else { echo "<td>" . $a_master . "<td>";}// $a_master doesn't work?> And the page1.php get include in the mainpage.php everything called from the adminReatriction function in the mainpage.php work fine except in the page3.php it can't find it!I know that I include a lot of page, can it be the problem?Thank you for your helpMat Link to comment Share on other sites More sharing options...
zppblood Posted February 2, 2007 Share Posted February 2, 2007 If I am understanding you correctly, add session_start() at the beginning. Link to comment Share on other sites More sharing options...
Matpatnik Posted February 2, 2007 Author Share Posted February 2, 2007 I just realized something, I can't call a variable if the variable isn't define before being include so I change the way the files where include and it work perfectly now.Now mainpage.php include page2.php and page2.php include page1.php (page2.php and page3.php are now in the same page: page2.php)I'm shearing my discovery :)edited: If I am understanding you correctly, add session_start() at the beginning.the sesion_start() is there I just didn't show it in there.I find the solution thank you Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now