63 lines
1.9 KiB
PHP
63 lines
1.9 KiB
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: .');
|
|
}
|
|
|
|
if (isset($_POST['form_id'])) {
|
|
switch ($_POST['form_id']) {
|
|
case 'reset_pw_form':
|
|
$msg = reset_password($_COOKIE['user_id'], $_POST['new_pw'], $_POST['verify_new_pw']);
|
|
// code...
|
|
break;
|
|
case 'update_email_form':
|
|
$msg = update_email($_COOKIE['user_id'], $_POST['new_email'], $_POST['verify_new_email']);
|
|
// code...
|
|
break;
|
|
case 'update_username_form':
|
|
$msg = update_username($_COOKIE['user_id'], $_POST['new_username'], $_POST['verify_new_username']);
|
|
// code...
|
|
break;
|
|
case 'delete_account_form':
|
|
$msg = delete_account($_COOKIE['user_id'], $_POST['delete_password'], $_POST['delete_verify_password']);
|
|
break;
|
|
// case 'request_role_form':
|
|
// // code...
|
|
// break;
|
|
default:
|
|
// code...
|
|
break;
|
|
}
|
|
echo $msg;
|
|
}
|
|
|
|
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();
|
|
else if ($_GET['action'] == 'view' && isset($_GET['user_id'])) {
|
|
echo user_view($_GET['user_id']);
|
|
}
|
|
|
|
include_once 'components/foot.php';
|