33 lines
896 B
PHP
33 lines
896 B
PHP
<?php
|
|
require_once 'functions/init.php';
|
|
|
|
require_once 'functions/functions.php';
|
|
include_once 'functions/account_functions.php';
|
|
|
|
$msg = '';
|
|
// Handle creating a new user.
|
|
if (isset($_POST['verify_password'])) {
|
|
$msg = create_account($_POST['username'], $_POST['email'], $_POST['password'], $_POST['verify_password'], 4, $_POST['profile_picture_upload']);
|
|
|
|
if ($msg === true)
|
|
header('Location: .');
|
|
}
|
|
|
|
if (isset($_POST['username'])) {
|
|
$msg = login($_POST['username'], $_POST['password'], (isset($POST['stay_logged_in']) ? true : false));
|
|
|
|
if ($msg === true)
|
|
header('Location: .');
|
|
}
|
|
|
|
include_once 'components/head.php';
|
|
|
|
if ($_GET['action'] == 'login')
|
|
echo login_form(($msg ? $msg : ''));
|
|
else if ($_GET['action'] == 'signup')
|
|
echo signup_form(($msg ? $msg : ''));
|
|
else if ($_GET['action'] == 'logout')
|
|
logout();
|
|
|
|
include_once 'components/foot.php';
|