[RESOLVED] ARGH!!! Braces and Includes
Okay well here goes.
On the header.php I've got an if statement that checks if a string is valid. If the string is valid it will print so this:
PHP Code:
if($string == 1) {
is at the end of header.php.
On index.php it will include the header and then do what it can do:
PHP Code:
include("header.php") ;
// Do the stuff
include("footer.php") ;
And at the end it will do the footer, which closes the braces:
Aaaanyway, on including running "index.php" I get a parse error, unexpected $END on header.php. This seems to be saying that it hasn't included all of the files before parsing... do i have to use another method, such as
PHP Code:
require("header.php");
???
Regards,
Rudi :wave:
Re: ARGH!!! Braces and Includes
Although the documentation does not say so, a little knowledge of how language parsers work suggests that each file must be syntactically complete, i.e. you cannot open any sort of construct in one file and close it in another.
Re: ARGH!!! Braces and Includes
But you can open it before you include it and close it after:
PHP Code:
if ($string==1) { // open
include('header.php');
} // close
Re: ARGH!!! Braces and Includes
Quote:
Originally Posted by visualAd
But you can open it before you include it and close it after:
PHP Code:
if ($string==1) { // open
include('header.php');
} // close
Yeah but the thing is... the header needs to be on every page to autenticate the string, it's a sortof member area.
I guess I'll just have to have in the header:
PHP Code:
if($string == "1") {
$auth['isadmin'] = "1";
}
and then on each page:
PHP Code:
if(isset($auth['isadmin'])) {
// do stuff
}
either that or would this have the same effect, in header.php:
PHP Code:
if($string != 1) {
die("You aint an admin! Stop buzzin' round 'ere!");
}
Because I guess that would virtually lock it, do you think that would have the same effect??
Rudi :wave: