Моя страница входа просто говорит
Ошибка разбора: неожиданный конец файла
Не могли бы вы мне помочь?
Я использую XAMPP (я не думаю, что это проблема, но я пишу как можно больше деталей, чтобы было легче ответить).
<?php
$Password = $_POST['Password'];
$Password = hash('sha256', '$Password');
$host = "localhost";
$user = "root";
// $password = "";
$dbName = "db1";
$dbTable = "users";
$link = mysqli_connect ($host, $user, $password);
$query = "SELECT * from ".$dbTable." WHERE Username = '$Username' AND Password = '$Password'";
$result = mysql_db_query($dbName, $query, $link);
while ($row = mysql_fetch_array($result)) {
print("$row[user]<br>");
print("$row[domain]<br>");
}
mysql_close ($link);
if ($row[user] == $clientUser || $row[domain] == $clientDomain) {
print("<h1>NOPE!</h1>\
");
?>
<!DOCTYPE html>
<html>
<head>
<title>Log In</title>
</head>
<body>
<form action="index.php" method="POST">
<label>Username:</label>
<br>
<input type="text" name="Username" placeholder="Username">
<br>
<br>
<label>Password:</label>
<br>
<input type="text" name="Password" placeholder="Password">
<button type="submit" name="login">Log In</button>
</form>
</body>
</html>
Вы, вероятно, не закрыли скобку для условия if в строке 22
увидеть этот ответ
<?php
$Password = $_POST['Password'];
$Password = hash('sha256', '$Password');
$host = "localhost";
$user = "root";
// $password = "";
$dbName = "db1";
$dbTable = "users";
$link = mysqli_connect ($host, $user, $password);
$query = "SELECT * from ".$dbTable." WHERE Username = '$Username' AND Password = '$Password'";
$result = mysql_db_query($dbName, $query, $link);
while ($row = mysql_fetch_array($result)) {
print("$row[user]<br>");
print("$row[domain]<br>");
}
mysql_close ($link);
if ($row[user] == $clientUser || $row[domain] == $clientDomain) {
print("<h1>NOPE!</h1>\
");
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Log In</title>
</head>
<body>
<form action="index.php" method="POST">
<label>Username:</label>
<br>
<input type="text" name="Username" placeholder="Username">
<br>
<br>
<label>Password:</label>
<br>
<input type="text" name="Password" placeholder="Password">
<button type="submit" name="login">Log In</button>
</form>
</body>
</html>
<?php
$Password = $_POST['Password'];
$Password = hash('sha256', '$Password');
$host = "localhost";
$user = "root";
// $password = "";
$dbName = "db1";
$dbTable = "users";
$link = mysqli_connect ($host, $user, $password);
$query = "SELECT * from ".$dbTable." WHERE Username = '$Username' AND Password = '$Password'";
$result = mysql_db_query($dbName, $query, $link);
while ($row = mysql_fetch_array($result)) {
print("$row[user]<br>");
print("$row[domain]<br>");
}
mysql_close ($link);
if ($row[user] == $clientUser || $row[domain] == $clientDomain) {
print( "<h1>NOPE!</h1>");
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Log In</title>
</head>
<body>
<form action="index.php" method="POST">
<label>Username:</label>
<br>
<input type="text" name="Username" placeholder="Username">
<br>
<br>
<label>Password:</label>
<br>
<input type="text" name="Password" placeholder="Password">
<button type="submit" name="login">Log In</button>
</form>
</body>
</html>