v0.1.0 completed. only the owner can create new articles, users can modify their password, username, email, or delete their account, there's auth and permissions preventing accessing other user's information, and more. onto the road to v0.2.0
This commit is contained in:
@@ -20,6 +20,33 @@ if (isset($_POST['username'])) {
|
||||
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')
|
||||
@@ -28,5 +55,8 @@ 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';
|
||||
|
||||
Reference in New Issue
Block a user