I cannot make it so i can login with both, when i try, it either doesnt register both email and username, or password doesnt work.
if(isset($_POST['mit'])){
$username = $_POST['user'];
$password = $_POST['word'];
$sql = "SELECT * FROM users WHERE user='$username' AND password='$password'";
$result = mysqli_query($db, $sql);
if (mysqli_num_rows($result) == 1){
$_SESSION['user'] = $username;
header("location: index.php");
}
else{
echo "<p style=\"color:white\"> Login failed</p>";
}
}
Page
<form action="log.php" method="post">
<h3>Username/Email:</h3>
<input type="text" name="user" placeholder="Username">
<h3>Password:</h3>
<input type="Password" name="word" placeholder="Password">
<br>
<input type="submit" name="mit">
</form>