Hello !!!!
I'm trying to do a php autentication with sessions, and, just after I type in the username and password and click submit, I get a :
Parse error: parse error, unexpected '<' in /var/www/free.fr/a/d/enfantsdelo/protected/edito.php on line 7
here is the page edito.php :
PHP Code:
<?php
session_start();
if($login_username=="") {
Header("Location: login.htm");
} else {
?>
// curiously, that's the line 7.
<HTML>
<HEAD>
<TITLE>Secret Stuff</TITLE>
</HEAD>
<BODY>
<H1>SECRET!</H1>
<P>This is a secret message.</P>
</BODY>
</HTML>
<?
}
?>
I tested different synthax, one involving echo and no break in the php code. It looked like that :
PHP Code:
<?php
session_start();
if($login_username=="") {
Header("Location: login.htm");
} else {
echo '
// line 7
<HTML>
<HEAD>
<TITLE>Secret Stuff</TITLE>
</HEAD>
<BODY>
<H1>SECRET!</H1>
<P>This is a secret message.</P>
</BODY>
</HTML>
';
}
?>
I got the same error message.
What have I done wrong ?
Header() should be lower-case: header(). However, I wouldn't think that would cause the error message you are receiving. Hmmmm.....assuming $login_username is supposed to be a session variable, I would check it like this:
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
PHP's predefined functions are incase sensitive, it's perfectly safe to use upper or lower case, thus that's not the problem.
Really? I have to admit I just assumed they were case-sensitive, since PHP's syntax is so similar to C and Perl.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
I'm ashamed... I'm really ashamed, and sooooo sorry !!!
I'm working on two sites at the moment. And I tested that one in my test server, the one which doesn't have any mysql database...
I tried it in my real website, and it didn't work for another stupid reason. But then, when I corrected it and tried again, I didn't realised I had corrected it only on the test server...
Don't hit me, please !!!
Sorry for making you lose your time like that, I feel really stupid...
I'm ashamed... I'm really ashamed, and sooooo sorry !!!
I'm working on two sites at the moment. And I tested that one in my test server, the one which doesn't have any mysql database...
I tried it in my real website, and it didn't work for another stupid reason. But then, when I corrected it and tried again, I didn't realised I had corrected it only on the test server...
Don't hit me, please !!!
Sorry for making you lose your time like that, I feel really stupid...
Happens to all of us occasionally. At least you didn't overwrite the new file with the old one, I have done that before, and it really sucks!
Bookmarks