I am trying to get the php/mysql to work so that it will take the username and password from a form and check if they are in the mysql table. If they are in the table it should log you in and send you to the index.php page(I changed the user/pass/database)
The form on the login page:
<form action="db_connect.php" method="post">
<input type="text" name="username" placeholder="Username" />
<input type="password" name="password" placeholder="Password" />
<input type="submit" value="Login" class="customButton" />
</form>
The db_connect.php:
<?php
$username = $_POST['username'];
$password = $_POST['password'];
$con = new mysqli_connect("localhost","user","password","database");
$query = mysqli_query($con,"SELECT * FROM members WHERE username='".$username."' AND password='".$password."'");
if (mysqli_num_rows($query) != 0){
$_SESSION['logged_in'] = true;
header('Location: index.php');
}else{
echo "Access denied";
}
?>