blob: fa37d1c611989cbfd44c862ecd98e045a3e2c3a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
<?php
#===============================================================================
# DEFINE: Administration
#===============================================================================
const ADMINISTRATION = true;
const AUTHENTICATION = true;
#===============================================================================
# INCLUDE: Initialization
#===============================================================================
require '../core/application.php';
#===============================================================================
# Execute database command(s)
#===============================================================================
if(HTTP::issetPOST('command')) {
if(HTTP::issetPOST(['token' => Application::getSecurityToken()])) {
try {
$Statement = $Database->query(HTTP::POST('command'));
do {
$result[] = print_r($Statement->fetchAll(), true);
} while($Statement->nextRowset());
} catch(PDOException $Exception) {
$messages[] = $Exception->getMessage();
}
} else {
$messages[] = $Language->text('error_security_csrf');
}
}
#===============================================================================
# Build document
#===============================================================================
$DatabaseTemplate = Template\Factory::build('database');
$DatabaseTemplate->set('FORM', [
'INFO' => $messages ?? [],
'TOKEN' => Application::getSecurityToken(),
'RESULT' => implode(null, $result ?? []),
'COMMAND' => HTTP::POST('command'),
]);
$MainTemplate = Template\Factory::build('main');
$MainTemplate->set('NAME', 'SQL');
$MainTemplate->set('HTML', $DatabaseTemplate);
echo $MainTemplate;
|