<?php
//check session
session_start();
//get variables
if ($_SERVER["REQUEST_METHOD"] == "POST"){
include_once('connect.php');
$username = mysqli_real_escape_string($con,$_POST['username']);
$password = mysqli_real_escape_string($con,$_POST['password']);

//confirm details from database

$sql = mysqli_query($con,"SELECT id FROM customers WHERE username ='$username' AND password='$password' LIMIT 1");
if (mysqli_num_rows($sql)< 1){
header('location:./loginfailed.html');
}else{
$_SESSION['user'] = $username;
$_SESSION['pass'] = $password;
$_SESSION['user_start'] = time();
$_SESSION['expire'] = time() + (60*60*0.50);
header("location:./loggingon.php");
}}
?>