-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
35 lines (34 loc) · 907 Bytes
/
index.php
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
<?php
ini_set('display_errors', 1);
include_once('php/twig/lib/Twig/Autoloader.php');
include_once('php/models/connection.php');
include_once('php/models/database.php');
$login = connection();
if (empty($_POST))
{
Twig_Autoloader::register();
$loader = new Twig_Loader_Filesystem('templates');
$twig = new Twig_Environment($loader, array(
'cache' => false
));
$bases = show_database($login);
$template = $twig->loadTemplate('index.twig');
echo $template->render(array('bases' => $bases, ));
}
if ($_POST)
{
var_dump($_POST);
if ($_POST["action"] == "create")
{
insert_database($_POST['basename'], $login);
}
else if ($_POST["action"] == "delete")
{
delete_database($_POST['basename'], $login);
}
else if ($_POST["action"] == "edit")
{
rename_database($_POST["newbasename"], $_POST["basename"]);
}
}
?>