-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
28 lines (20 loc) · 699 Bytes
/
index.php
File metadata and controls
28 lines (20 loc) · 699 Bytes
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
<?php
require_once "vendor/autoload.php";
include_once "model/bd.php";
$loader = new \Twig\Loader\FilesystemLoader('view');
$twig = new \Twig\Environment($loader);
// Comprobamos si la base de datos necesita ser set
DB_init();
$estadisticas = getEstadisticas();
$productos = getProductosComprados();
$user='';
session_start();
// Si la sesion ya ha sido iniciada, cogemos el rol del usuario
if(isset($_SESSION['idusuario'])){
$id = $_SESSION['idusuario'];
$user = getUserById($id);
}
echo $twig->render('portada.html', ['estadisticas' => $estadisticas,
'productos_comprados' => $productos,
'user' => $user]);
?>