51 lines
1.4 KiB
PHP
51 lines
1.4 KiB
PHP
<?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']) || isset($_FILES['csv'])) {
|
|
if (!empty($_FILES['csv']['name'])) {
|
|
upload($_FILES['csv'], $_ENV['UPLOAD_TMP_FQ_PATH'], 'new_users');
|
|
create_users_from_csv($_ENV['UPLOAD_TMP_FQ_PATH'] . 'new_users.csv');
|
|
delete_file($_ENV['UPLOAD_TMP_FQ_PATH'] . 'new_users.csv');
|
|
} else {
|
|
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';
|