我的登录脚本中出现了一个奇怪的错误。通过研究,我无法确定问题所在。我想知道是否有人可以帮助我谢谢。这是错误信息,
解析错误:语法错误,第 43 行的意外 $end。
代码:
<?php
session_start();
if(!isset($_SESSION["user_id"])){
header("location:../../login.html");
}
?>
<?php
$username = $_POST['txt_username'];
$password = $_POST['txt_password'];
if ($username&&$password){
$connect = mysql_connect("server", "username", "password") or die("No Server Found");
mysql_select_db("databse") or die("No Connection");
$query = mysql_query("SELECT * FROM account WHERE username='$username'");
$numrows = mysql_num_rows($query);
if($numrows !=0){
while ($rows = mysql_fetch_assoc($query)){
$dbusername = $row['username'];
$dbpassword = $row['password'];
}
if ($username == $dbusername && $password == dbpassword) {
echo "Login Successful. <a href='homepage.html'>Click Here to go to the home page</a>";
$_SESSION['username'] = $dbusername;
} elseif ($username == '' || $password == '') {
die("Please enter a username and password");
} elseif (empty($dbusername)) {
die("This account does not exsist");
} else {
die("Please enter a username and password");
}
}
?>