My login page just says
Parse Error: Unexpected end of file
Can you please help me?
I am Using XAMPP (I don't think that's the problem but I'm writing as many details as I can to make it easier to answer).
<?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>
You probably not closed a brace for if condition in line number 22
see this answer
<?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>