Hi,
I've spent the last three hours trying to find the error, so I hope you guys can help me. I get these messages:
Parse error: parse error, unexpected $ in /myhotel/body.header.php on line 27
Parse error: parse error, unexpected '}' in /myhotel/body.footer.php on line 7
Here are the files:
#body.header.php
<?php
if(isset($PHP_AUTH_USER) && isset($PHP_AUTH_PW)) {
include 'connect.php';
$psw = md5($PHP_AUTH_PW);
$sql = "SELECT username,password FROM mytable WHERE username = '$PHP_AUTH_USER' AND password = '$psw'";
$res = mysql_query($sql);
$num = mysql_numrows($res);
if($num != 0) {
?>
<html>
<head>
</head>
<body> // <-- Line 27
#body.footer.php
</body>
</html>
<?php
} else { // <-- Line 7
echo 'Invalid username or password!';
}
}
if(!isset($PHP_AUTH_USER) && !isset($PHP_AUTH_PW)) {
header('WWW-Authenticate: Basic realm="MyRealm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authentication required';
exit;
}
?>
I've already checked the other posts on those error messages, but I still can't find the problem. I've double checked the db connection - should be ok.