<?php

require_once("config/config.php");
require_once("foo/functions.php");
dbconnect();
session_start();

if ($_SERVER['REQUEST_METHOD'] === 'POST') {

	if (user_attempt($_POST['username'], $_POST['password'], '1')) {
		redirect('pin.php');
	}
	elseif (user_exist($_POST['username'], $_POST['password'])) {
		redirect('index.php?error=' . urlencode('Account Not Yet Activated'));
	}
	else {
		redirect('index.php?error=' . urlencode('Wrong UserID or Password'));
	}
}

?>