/
validation.php
87 lines (72 loc) · 2.41 KB
/
validation.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php include("begin.php"); ?>
<div class='marg'>
<h1>Merci pour cet achat!</h1>
<?php
$places = "";
if(!isset($_GET["over"])){
$places = reserver($_COOKIE['idMatch'], $_COOKIE['nbPlaces'], $_COOKIE['place']);
setcookie("placesAttribuees", $places, time()+86400);
$_COOKIE["place"] = $places;
header('Location: validation.php?over=1');
}
else if(strcmp($_COOKIE["place"], 'Libre') != 0) {
echo("<p>Votre/Vos numéro(s) de place(s) : " . $_COOKIE["placesAttribuees"] . "</p>");
$places = $_COOKIE["placesAttribuees"];
}
else {
echo("<p>Vous avez réservé ".$_COOKIE["nbPlaces"]." place(s) en emplacement libre.");
$places = "Placement libre";
}
?>
</div>
<?php
require('html_table.php');
$bdd = Connect_db();
$SQL_Query = 'insert into Facture values(null)';
$query = $bdd -> prepare($SQL_Query);
$query -> execute();
$SQL_Query = 'select max(idFacture) as m from Facture';
$query = $bdd -> prepare($SQL_Query);
$query -> execute();
$idFacture = 0;
while($line = $query -> fetch()){
$idFacture = $line["m"];
}
$pdf=new PDF();
$pdf->AddPage();
$pdf->SetFont('Arial','',12);
$html='
<table border="1">
<tr>
<td width="200" height="50">Tour</td><td width="400" height="50">'.getTour($_COOKIE["jourMatch"]).'</td>
</tr>
<tr>
<td width="200" height="50">Match</td><td width="400" height="50">'.getVs($_COOKIE["idMatch"], $_COOKIE["typeMatch"]).'</td>
</tr>
<tr>
<td width="200" height="50">Court</td><td width="400" height="50">'.getCourt($_COOKIE["idMatch"]).'</td>
</tr>
<tr>
<td width="200" height="50">Emplacement</td><td width="400" height="50">'.$_COOKIE["place"].'</td>
</tr>
<tr>
<td width="200" height="50">Date</td><td width="400" height="50">'.getJour($_COOKIE["jourMatch"]).'</td>
</tr>
<tr>
<td width="200" height="50">Heure</td><td width="400" height="50">'.getHeure($_COOKIE["heureMatch"]).'</td>
</tr>
<tr>
<td width="200" height="50">Nombre de places</td><td width="400" height="50">'.$_COOKIE["nbPlaces"].'</td>
</tr>
<tr>
<td width="200" height="50">Prix total</td><td width="400" height="50">'.$_COOKIE["prix"].' euros</td>
</tr>
<tr>
<td width="200" height="50">Numeros de place</td><td width="400" height="50">'.$places.'</td>
</tr>
</table>';
$pdf->WriteHTML($html);
$pdf->Output("F","./factures/Facture n".$idFacture.".pdf");
?>
<div class='marg'><a target="_blank" href=<?php echo('"pdf.php?pdf='.$idFacture.'"'); ?>>Télécharger la facture</a></div>
<?php include("end.php"); ?>