2023-09-29 21:29:29 +02:00
|
|
|
<?php
|
|
|
|
/* curload
|
|
|
|
* Simple file uploading using POST requests and temporary keys
|
|
|
|
* Licensed under the GNU Affero General Public License version 3.0
|
|
|
|
*/
|
|
|
|
|
2023-09-30 20:31:01 +02:00
|
|
|
include "core.php";
|
2023-09-30 01:28:36 +02:00
|
|
|
include "config.php";
|
2023-09-29 21:29:29 +02:00
|
|
|
include "create-table.php";
|
|
|
|
|
2023-09-30 23:30:08 +02:00
|
|
|
$Authorized = 0;
|
|
|
|
$Primary = 0;
|
|
|
|
|
2023-09-30 23:13:22 +02:00
|
|
|
if (!isset($_COOKIE[$cookieName]) || !isset($_COOKIE[$cookieTypeName])) {
|
|
|
|
header('Location: login.php?redir=admin');
|
|
|
|
die();
|
|
|
|
} else if ($_COOKIE[$cookieTypeName] != 2) { // not allowed
|
|
|
|
header('Location: /');
|
2023-09-30 01:28:36 +02:00
|
|
|
die();
|
|
|
|
}
|
|
|
|
|
2023-09-30 23:13:22 +02:00
|
|
|
// in case admin keys are disabled
|
|
|
|
if (!$enableAdminKeys || $enableAdminKeys == "false") {
|
|
|
|
header('Location: /');
|
|
|
|
die();
|
2023-09-29 21:29:29 +02:00
|
|
|
}
|
2023-09-30 01:28:36 +02:00
|
|
|
|
2023-09-30 23:30:08 +02:00
|
|
|
$Database = createTables($sqlDB);
|
|
|
|
$DatabaseQuery = $Database->query('SELECT * FROM admins');
|
|
|
|
|
|
|
|
while ($line = $DatabaseQuery->fetchArray()) {
|
|
|
|
if ($line['key'] == $_COOKIE[$cookieName] && $_COOKIE[$cookieName] != "" && $line['key'] != "" && ($enableKeys || $enableKeys == "true")) {
|
|
|
|
$Authorized = 1;
|
|
|
|
$Primary = $line['primaryadmin'];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// not authorized
|
|
|
|
if ($Authorized != 1) {
|
|
|
|
header('Location: /');
|
|
|
|
die();
|
|
|
|
}
|
|
|
|
|
|
|
|
$html = "";
|
|
|
|
$html = printHeader($html);
|
|
|
|
|
2023-09-30 20:31:01 +02:00
|
|
|
$html = printFooter($html);
|
2023-09-30 01:28:36 +02:00
|
|
|
|
|
|
|
print "$html";
|
|
|
|
|
2023-09-29 21:29:29 +02:00
|
|
|
?>
|