function isConnected() { if (isset($_COOKIE['email']) && isset($_COOKIE['pwd'])) { $bdd = Connect_db(); $query = $bdd->prepare('SELECT email, password FROM Membre'); $query->execute(); while ($line = $query->fetch()) { if ($line['email'] == $_COOKIE['email'] && $line['password'] == $_COOKIE['pwd']) { return true; } } } return false; }
<?php include "begin.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="30">cell 1</td><td width="200" height="30" bgcolor="#D0D0FF">cell 2</td> </tr> <tr> <td width="200" height="30">cell 3</td><td width="200" height="30">cell 4</td> </tr> </table>'; $pdf->WriteHTML($html); $pdf->Output("F", "./factures/Facture n" . $idFacture . ".pdf"); ?> <a href=<?php echo '"pdf.php?pdf=' . $idFacture . '"';
function connectAdmin($id, $pwd) { $bdd = Connect_db(); $SQL_Query = "select * from Admin where id = ? and pwd = ?"; $query = $bdd->prepare($SQL_Query); $query->bindParam(1, $id); $query->bindParam(2, $pwd); $i = 0; $query->execute(); if ($query->fetch()) { session_start(); $_SESSION['id'] = $id; $_SESSION['pwd'] = $pwd; return true; } else { return false; } }
function getPrixPlaces($idMatch) { $array[0] = 0; $bdd = Connect_db(); $SQL_Query = 'SELECT prix as p, emplacement as e From Place WHERE idMatch = ' . $idMatch . ' GROUP BY e, p'; $query = $bdd->prepare($SQL_Query); $query->execute(); $i = 0; while ($nb = $query->fetch()) { $array[$i] = $nb["p"]; $i++; } return $array; }