Files
web/todo.php
T

30 lines
742 B
PHP

<?php
require_once 'functions/init.php';
require_once 'functions/functions.php';
require_once 'functions/todo_functions.php';
// UI Components
foreach (glob('components/todo/*.php') as $file)
require_once $file;
include_once 'components/head.php';
if (!isset($_SESSION['role_id'])) {
$redirect = 'todo.php?view=display';
header('Location: user.php?view=login&redirect=' . urlencode($redirect));
}
if (isset($_GET['view']))
$view = $_GET['view'];
else
$view = 'display';
switch ($view) {
case 'display':
$todos = exec_stmt('SELECT * FROM todos WHERE user_id = ? ORDER BY updated_at DESC', 'i', $_SESSION['user_id']);
echo todo_display($todos);
break;
}
include_once 'components/foot.php';