This repository has been archived by the owner on Oct 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stats.php
66 lines (55 loc) · 1.62 KB
/
stats.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
require_once("php/tools.php");
require_once("php/database.php");
if (! isset($_SESSION["id"])) {
header ("location: login.php");
exit();
}
try {
$connessione = new Database();
$n_liste = $connessione->getNumeroListePerUtente($_SESSION["id"]);
$n_film = $connessione->getNumeroFilmPerUtente($_SESSION["id"]);
$generi = $connessione->getNumeroPerGenerePerUtente($_SESSION["id"]);
$lunghi = $connessione->getFilmPiuLunghiPerUtente($_SESSION["id"], 5);
unset($connessione);
} catch (Exception) {
unset($connessione);
Tools::errCode(500);
exit();
}
$page = Tools::buildPage($_SERVER["SCRIPT_NAME"]);
Tools::replaceAnchor($page, "n_liste", $n_liste[0]["n"]);
Tools::replaceAnchor($page, "n_film", $n_film[0]["n"]);
$mess = true;
if (! empty($generi)) {
$mess = false;
Tools::toHtml($generi);
$ummagumma = Tools::getSection($page, "generi_riga", "");
$res = "";
foreach ($generi as $g) {
$t = $ummagumma;
Tools::replaceAnchor($t, "genere", $g["nome"]);
Tools::replaceAnchor($t, "numero", $g["n"]);
$res .= $t;
}
Tools::replaceSection($page, "generi_riga", $res);
} else
Tools::replaceSection($page, "generi", "");
if (! empty($lunghi)) {
$mess = false;
Tools::toHtml($lunghi);
$ummagumma = Tools::getSection($page, "lunghi_riga", "");
$res = "";
foreach ($lunghi as $l) {
$t = $ummagumma;
Tools::replaceAnchor($t, "nome", $l["nome"]);
Tools::replaceAnchor($t, "durata", Tools::minutiAStringa($l["durata"]));
$res .= $t;
}
Tools::replaceSection($page, "lunghi_riga", $res);
} else
Tools::replaceSection($page, "lunghi", "");
if (! $mess)
Tools::replaceSection($page, "message", "");
Tools::showPage($page);
?>