<?php

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    // Get form information and store within variable
    $username = $_POST["username"];
    $email = $_POST["email"];
    $password = $_POST["password"];
    $cPassword = $_POST["cPassword"];
    // Include helper functions
    include "./data_model/model.php";
    $model = new Database_Reader();
    // If valid user, insert information into database
    if ($model->valid_user($username, $password) === true) {
        $model->new_user($username, $email, $password);
    }
    header('Location: register.php');
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
	<script type="text/javascript" src="createAccountScript.js"></script>
	<link rel="stylesheet" type="text/css" href="PLACEHOLDER.css">
	<meta charset="UTF-8">
	<title>Create Account</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">

	<!--Bootstrap-->
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
	<link rel="stylesheet" href="demoFiles/theme.min.css">