diff --git a/admin.php b/admin.php
index bf85306..9db80fa 100644
--- a/admin.php
+++ b/admin.php
@@ -11,19 +11,25 @@ else if ($_COOKIE['role_id'] >= 3)
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;
+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]);
+ case 'view':
+ header('Location: user.php?action=view&user_id=' . $_POST['selected_users'][0]);
+ }
}
}
diff --git a/components/foot.php b/components/foot.php
index 165ddd8..98d0e19 100644
--- a/components/foot.php
+++ b/components/foot.php
@@ -2,7 +2,8 @@
diff --git a/components/nav.php b/components/nav.php
index 1d6e7ff..bbf7315 100644
--- a/components/nav.php
+++ b/components/nav.php
@@ -11,7 +11,7 @@ $nav = '
if (isset($_COOKIE['role_id']) && $_COOKIE['role_id'] <= 2) {
$nav .= '
-
Admin
+ Admin
';
}
diff --git a/css/base.css b/css/base.css
index 5d0ee78..213a392 100644
--- a/css/base.css
+++ b/css/base.css
@@ -256,7 +256,7 @@ table tr td label {
}
.narrow {
- width: 40%;
+ width: 20%;
}
.tag {
diff --git a/functions/account_functions.php b/functions/account_functions.php
index d12b0af..583927d 100644
--- a/functions/account_functions.php
+++ b/functions/account_functions.php
@@ -153,7 +153,7 @@ function signup_form($error_msg = '')
return $form;
}
-function signup($username, $email, $password, $verify_password, $role_id, $upload = null, $x = null, $y = null, $crop_width = null)
+function create_user($username, $email, $password, $verify_password, $role_id, $upload = null, $x = null, $y = null, $crop_width = null)
{
if ($password != $verify_password) {
$error_msg = '
@@ -184,10 +184,6 @@ function signup($username, $email, $password, $verify_password, $role_id, $uploa
$stmt = 'INSERT INTO user (user_id, username, email, password_hash, role_id' . (!empty($target) ? ', profile_picture' : '') . ') VALUES (' . $id . ', "' . $username . '", "' . $email . '", "' . $password_hash . '", ' . $role_id . (!empty($target) ? ', "' . $target . '"' : '') . ');';
exec_statement($stmt, 0);
-
- login($username, $password, false);
-
- return true;
}
function profile_cropper()
@@ -448,7 +444,7 @@ function delete_account($user_id, $password = null, $verify_password = null)
exec_statement($stmt, 1);
logout();
} else if ($_COOKIE['role_id'] < 3) {
- $query = 'SELECT user_id FROM user WHERE user_id = ' . $user_id . ';';
+ $query = 'SELECT user_id, profile_picture FROM user WHERE user_id = ' . $user_id . ';';
$user = query_one_result($query);
if ($user['user_id'] == 2025) {
diff --git a/functions/admin_functions.php b/functions/admin_functions.php
index 807487e..2ca091d 100644
--- a/functions/admin_functions.php
+++ b/functions/admin_functions.php
@@ -1,8 +1,32 @@
View Articles
-