<?php
require 'config.php';
if (isset($_POST['login'])) {
$password = mysqli_real_escape_string($con, $_POST['tpw']);
$username= mysqli_real_escape_string($con, $_POST['username']);
$query = "SELECT * FROM tinfo WHERE username='$username' AND password='$password'";
$results = mysqli_query($con, $query);
if (mysqli_num_rows($results) == 1) {
$_SESSION['username'] = $username;
$_SESSION['success'] = "You are now logged in";
header('location: ../html/register.html');
}else {
echo "Wrong username/password combination";
}
}
?>