Need advice on weird Parse error in conditional...
| From: | Todd Daniel Woodward | Date: | Fri, 15 Sep 2000 19:33:54 +0000 |
| Subject: | Need advice on weird Parse error in conditional... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-16980@lists.php.net to get a copy of this message | ||
Pretext:
I'm getting a PARSE error at "}". I'm sure it's something stupid, but I
can't figger' it out for some reason after spending 4 hours on it.
Using PHP4.0.1p12.
I have an HTML file which has content. I have set up a system to require
login to read that content.
The HTML (phtml) file has a REQUIRE at the very top and the very bottom of
the file, essentially login.inc and login_footer.inc.
So the page looks like this:
<LOGIN INCLUDE>
HTML <--- Content I want to protect.
<LOGIN FOOTER INCLUDE>
In login.inc
Detects if the user is logged in by calling a "check for login" function.
<?PHP
REQUIRE("authfunctions.inc");
global $submit,$status;
unset ($status);
$status = user_isloggedin();
if ($status) {
?>
So if the status is good or TRUE--the user IS logged in--the content will be
displayed.
In login_footer.inc, I have a conditional if the user is not logged in to
ask for login.
<?PHP
}
if (!$status) { //perhaps an ELSE here would be better.
if ($submit == "submit") {
$result = user_login($email,$password);
if ($result == true) {
//show the article...header(location ?
}
else {
echo "<H1>Try again<H2>";
}
}
// HTML follows with login form with action PHP_SELF. ?>
Why would I get a parse error pointing to the "}" in login_footer.inc? There
are no other "{}" in the HTML or anything else errant that I can detect.
HELP!
I've been tossing PHP books around the room and I can't seem to figger this
one out.
Thanks,
Todd Daniel Woodward
Technical Consultant
RadioDigest.com
http://radiodigest.com