<?php

require_once("Models/User.php");

$user = new User();
$userDataSet = new UserDataSet();

if (isset($_POST["loginButton"])) {
    $username = $_POST["username"];
    $password = hash("sha256", $_POST["password"]);

    // create a new student dataset object that we can generate data from
    if($userDataSet->checkUserCredentials($username, $password)) {
        $user->Authenticate($username, $password);
    }
    else {
        echo "Error in Uname / Pass";
    }
}

if (isset($_POST["logoutButton"]))
{
    $user->logout();
}
