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:
@@ -9,6 +9,30 @@ if (!empty($_FILES['upload'])) {
|
||||
upload($_FILES['upload'], $_ENV['UPLOAD_TMP_FQ_PATH'], isset($_POST['filename']) ? $_POST['filename'] : null);
|
||||
}
|
||||
|
||||
function delete_dir($dir)
|
||||
{
|
||||
if (!is_dir($dir)) return false;
|
||||
|
||||
if (substr($dir, strlen($dir) - 1, 1) != '/') {
|
||||
$dir .= '/';
|
||||
}
|
||||
$files = glob($dir . '*', GLOB_MARK);
|
||||
foreach ($files as $file) {
|
||||
if (is_dir($file))
|
||||
delete_dir($file);
|
||||
else
|
||||
delete_file($file);
|
||||
}
|
||||
rmdir($dir);
|
||||
}
|
||||
|
||||
function delete_file($file)
|
||||
{
|
||||
if (!file_exists($file)) return false;
|
||||
|
||||
unlink($file);
|
||||
}
|
||||
|
||||
function upload($input, $dest_dir, $filename = null)
|
||||
{
|
||||
$filetype = strtolower(pathinfo($input['name'], PATHINFO_EXTENSION));
|
||||
|
||||
Reference in New Issue
Block a user