|
-
Jul 9th, 2006, 05:23 PM
#1
Thread Starter
Hyperactive Member
[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
-
Jul 9th, 2006, 06:22 PM
#2
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.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jul 9th, 2006, 06:25 PM
#3
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
-
Jul 9th, 2006, 06:58 PM
#4
Thread Starter
Hyperactive Member
Re: ARGH!!! Braces and Includes
 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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|