forked from Fecsio/WeBotanic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
visualPrenotazioni.php
48 lines (38 loc) · 1.58 KB
/
visualPrenotazioni.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
<?php
session_start();
# se non sei loggato, errore
if( !isset($_SESSION['logged']) or $_SESSION['logged']==0)
header("Location: errore.html");
else
{
$sql = "SELECT Id, Intestatario, Tipo, DataP FROM Prenotazioni ORDER BY DataP, Id";
require "php/connessione.php";
$output = $connessione->query($sql);
$page = file_get_contents("templates/admin/visualPrenotazioni.txt");
if(!$output){
$stampa = servError() ;
$page = str_replace('contenuto', $stampa, $page);
}
else {
$stampa = "";
if($output->num_rows == 0) {
$stampa .= "<div class=\"content\"> <p> Nessuna Prenotazione trovata </p><p id=\"indietro\"><a href= \"adminPanel.php\">Torna al <span xml:lang=\"fr\">menu</span> precedente</a></p> </div>";
$page = str_replace('contenuto', $stampa, $page);
}
else {
$table = file_get_contents('templates/admin/tabVisualPrenotazioni.txt');
foreach($output as $campo => $cont) {
$stampa .= "<tr> \n \t";
foreach($cont as $i => $val) {
$stampa .= "<td>".$val."</td> \n \t";
}
$stampa .= "</tr>";
}
$table =str_replace('corpoTabella', $stampa, $table);
$page = str_replace('contenuto', $table, $page);
}
}
echo $page;
$connessione->close();
}
?>