implemented admin control panel with the ability to delete articles/users in bulk, and open user panels with the standard options to reset passwords, change email/usernames, or delete. additionally, updated SQL schema, created dummy data, and fixed some bugs.

This commit is contained in:
Joshua Ashton
2025-03-30 17:01:29 -06:00
parent 86823cbd3e
commit e6735a9a20
18 changed files with 414 additions and 61 deletions
+44
View File
@@ -0,0 +1,44 @@
<?php
require_once 'functions/init.php';
require_once 'functions/functions.php';
include_once 'components/head.php';
if (!isset($_COOKIE['role_id']))
header('Location: user.php');
else if ($_COOKIE['role_id'] >= 3)
header('Location: user.php?action=view&user_id=' . $_COOKIE['user_id']);
include_once 'functions/admin_functions.php';
if (isset($_POST['action']) && isset($_POST['form_id'])) {
switch ($_POST['action']) {
case 'delete':
if ($_POST['form_id'] == 'users')
foreach ($_POST['selected_users'] as $id)
delete_account($id);
else if ($_POST['form_id'] == 'articles')
foreach ($_POST['selected_articles'] as $id)
delete_article($id);
break;
case 'view':
header('Location: user.php?action=view&user_id=' . $_POST['selected_users'][0]);
}
}
if (isset($_GET['view'])) {
switch ($_GET['view']) {
case 'users':
echo admin_user_view();
break;
case 'articles':
echo admin_article_view();
break;
}
} else {
echo admin_article_view();
}
include_once 'components/foot.php';