-
Notifications
You must be signed in to change notification settings - Fork 0
/
query.php
39 lines (36 loc) · 997 Bytes
/
query.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
36
37
38
39
<?php
ini_set('display_errors', 1);
include_once('php/twig/lib/Twig/Autoloader.php');
include_once('php/models/connection.php');
include_once('php/models/freequery.php');
$login = connection();
if(empty($_POST))
{
Twig_Autoloader::register();
$loader = new Twig_Loader_Filesystem('templates'); // Dossier contenant les templates
$twig = new Twig_Environment($loader, array(
'cache' => false
));
$template = $twig->loadTemplate('query.twig');
echo $template->render(array(
// 'tables' => $table_stats,
// 'basename' => $db,
));
}
else if ($_POST["sql"])
{
$retour = free_request($login, $_POST["sql"]);
//$retour = array_values($retour);
//var_dump($retour);
Twig_Autoloader::register();
$loader = new Twig_Loader_Filesystem('templates'); // Dossier contenant les templates
$twig = new Twig_Environment($loader, array(
'cache' => false
));
$template = $twig->loadTemplate('query.twig');
echo $template->render(array(
'results' => $retour,
// 'basename' => $db,
));
}
?>