-
Notifications
You must be signed in to change notification settings - Fork 0
/
gestioneventos.php
43 lines (33 loc) · 1.24 KB
/
gestioneventos.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
40
41
42
43
<?php
require_once "/usr/local/lib/php/vendor/autoload.php";
include("bd.php");
$loader = new \Twig\Loader\FilesystemLoader('templates');
$twig = new \Twig\Environment($loader);
session_start();
$conexion = new BDGestion();
$identificado = false;
if(isset($_SESSION['identificado'])) {
$identificado = true;
}
if($identificado) {
$usuario = $conexion->cargarUsuario($_SESSION['nameUsuario']);
}
if($_SERVER['REQUEST_METHOD'] === 'GET') {
if($usuario['gestor'] == 1) {
if(isset($_GET['ev']) && ctype_digit($_GET['ev']) && isset($_GET['delete']) && is_string($_GET['delete']) && $_GET['delete'] == true) {
$conexion->borrarEvento($_GET['ev']);
if(isset($_GET['evento']) && $_GET['evento'] == true) {
header("Location: index.php");
}
else {
header("Location: gestioneventos.php");
}
}
}
}
$eventos = array();
if($usuario['gestor'] == 1) {
$eventos = $conexion->getAllEventos();
}
echo $twig->render('gestioneventos.html', ['identificado' => $identificado, 'usuario' => $usuario, 'eventos' => $eventos]);
?>