echo $_COOKIE["place"];
?>
        </p>
        <p>
            <label class = 'strong'>Nombre de places : </label><?php 
echo $_COOKIE["nbPlaces"];
?>
        </p>
        <p>
            <label class = 'strong'>Date : </label><?php 
echo getJour($_COOKIE["jourMatch"]);
?>
        </p>
        <p>
            <label class = 'strong'>Heure : </label><?php 
echo getHeure($_COOKIE["heureMatch"]);
?>
        </p>

        <form action="promo.php" method="post">
            <p>
                <label class = 'strong'>Code Promo :</label>
                <input type="number" id="cp" name="cp" min = "0"/>
            </p>
            <p>
                <button type="submit">Valider le code promotionnel</button>
            </p>
        </form>

        <?php 
if (isset($_GET["red"]) && $_GET["red"] == 1 && isset($_COOKIE["reduc"])) {
Example #2
0
function afficherTableau()
{
    $retour = '';
    $bdd = Connect_db();
    $i = 0;
    $ligneMax = 0;
    $colMax = 0;
    $matrice[0][0] = null;
    $count = 0;
    $match = new Match();
    $match->id = 0;
    $SQL_Query = 'select max(c) as max from (select count(idMatch) as c from Matchs group by jourMatch) as yolo';
    $query = $bdd->prepare($SQL_Query);
    $query->execute();
    while ($line = $query->fetch()) {
        $ligneMax = $line["max"];
    }
    $SQL_Query = 'SELECT idMatch as id, typeMatch as t, jourMatch as j FROM Matchs order by jourMatch, heureMatch';
    $query = $bdd->prepare($SQL_Query);
    $query->execute();
    while ($line = $query->fetch()) {
        //Remplit le tableau "matrice" qui contient tous les matchs simples de la bd. Avec en colonnes les différents jours et en ligne la liste des matchs ce jour.
        if ($line["j"] != $colMax + 1) {
            $colMax = $line["j"] - 1;
            //j représente la colonne à traiter, donc la journée. Quand on change de jour, on met à jour j et on réinitialise i
            $i = 0;
        }
        if ($line["t"] == 1) {
            $SQL_QuerySimple = 'SELECT heureMatch as h, nomJoueur as n
                                FROM Matchs, Joueur
                                WHERE (Joueur.idJoueur = Matchs.idJoueur1
                                OR Joueur.idJoueur = Matchs.idJoueur2)
                                AND idMatch = ' . $line["id"] . '
                                ORDER BY jourMatch, heureMatch';
            $querySimple = $bdd->prepare($SQL_QuerySimple);
            $querySimple->execute();
            $count = 0;
            while ($simple = $querySimple->fetch()) {
                if ($count == 0) {
                    $match = new Match();
                    $match->id = $line["id"];
                    $match->type = 1;
                    $match->jourMatch = $line["j"];
                    $match->heureMatch = $simple["h"];
                    $match->joueur1 = $simple["n"];
                    $match->joueur2 = null;
                    $matrice[$i][$colMax] = $match;
                    $count++;
                } else {
                    $matrice[$i][$colMax]->joueur2 = $simple["n"];
                    $i++;
                }
            }
        } else {
            $SQL_QueryDouble = 'SELECT heureMatch AS h, nomJoueur AS n
                                FROM Matchs AS m
                                JOIN Equipe_Joueurs AS eq ON m.idEquipe1 = eq.idEquipeJoueurs
                                        OR m.idEquipe2 = eq.idEquipeJoueurs
                                        JOIN Joueur ON Joueur.idJoueur = eq.idJoueur1
                                                OR Joueur.idJoueur = eq.idJoueur2
                                WHERE idMatch = ' . $line["id"];
            $queryDouble = $bdd->prepare($SQL_QueryDouble);
            $queryDouble->execute();
            $count = 0;
            while ($double = $queryDouble->fetch()) {
                if ($count == 0) {
                    $match = new Match();
                    $match->id = $line["id"];
                    $match->type = 2;
                    $match->jourMatch = $line["j"];
                    $match->heureMatch = $double["h"];
                    $match->joueur1 = $double["n"];
                    $matrice[$i][$colMax] = $match;
                    $match->joueur3 == null;
                    $match->joueur4 == null;
                    $match->joueur2 == null;
                    $count++;
                } else {
                    if ($count == 1) {
                        $match->joueur2 = $double["n"];
                        $count++;
                    } else {
                        if ($count == 2) {
                            $match->joueur3 = $double["n"];
                            $count++;
                        } else {
                            if ($count == 3) {
                                $match->joueur4 = $double["n"];
                                $count++;
                                $i++;
                            }
                        }
                    }
                }
            }
        }
    }
    $i = 0;
    $j = 0;
    while ($i < $ligneMax) {
        $retour .= '<tr>';
        while ($j <= 6) {
            $data = '';
            if (isset($matrice[$i][$j])) {
                $match = new Match();
                $match = $matrice[$i][$j];
                $data = '<div class = "match"><a class = "noStyle" href="./place.php?id=' . $match->id . '">';
                $data .= getHeure($match->heureMatch) . '<br/>';
                if ($match->type == 1) {
                    $data .= $match->joueur1;
                    $data .= ' VS. ';
                    $data .= $match->joueur2;
                } else {
                    $data .= $match->joueur1;
                    $data .= ' - ';
                    $data .= $match->joueur2;
                    $data .= '<br/>VS.<br/>';
                    $data .= $match->joueur3;
                    $data .= ' - ';
                    $data .= $match->joueur4;
                }
                $data .= '</a></div>';
            }
            $retour .= '<td>';
            $retour .= $data;
            $retour .= '</td>';
            $j++;
        }
        $retour .= '</tr>';
        $i++;
        $j = 0;
    }
    return $retour;
}
Example #3
0
<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