<?php

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

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

	if (pin_attempt($_SESSION['user_login'], $_POST['pin'])) {
		log_info($_SERVER['REMOTE_ADDR'], $_SESSION['user_login'], $_SESSION['user_acc'], 'Successfully Signed into Account');
		redirect('checksplash.php');
	}
	else {
		redirect('pin.php?error=' . urlencode('Wrong Pin'));
	}
}

?>