This commit is contained in:
2025-05-01 14:42:12 -06:00
parent 693d11c506
commit bd59f428ba
13 changed files with 288 additions and 124 deletions
+19
View File
@@ -6,6 +6,9 @@ if (isset($_POST['ajax_id'])) {
case 'todo':
handle_todo();
break;
case 'login':
handle_login();
break;
}
} else {
$response = [
@@ -15,6 +18,22 @@ if (isset($_POST['ajax_id'])) {
echo json_encode($response);
}
function handle_login()
{
$response = ['log' => []];
if (isset($_POST['user_id']) && isset($_POST['username']) && isset($_POST['role'])) {
$response['log'][] = 'Required parameters met. Logging user in.';
$_SESSION['user_id'] = $_POST['user_id'];
$_SESSION['username'] = $_POST['username'];
$_SESSION['role_id'] = $_POST['role'];
$response['redirect'] = 'articles.php?view=list';
}
echo json_encode($response);
}
function handle_todo()
{
include 'functions/todo_functions.php';