public static function getInstance()
 {
     if (!isset(self::$_instance)) {
         try {
             self::$_instance = new PDO('mysql:host=localhost;dbname=aero_bd', 'root', '');
         } catch (PDOException $e) {
             echo "Erreur à la connexion avec la BDD :" . $e;
         }
     }
     return self::$_instance;
 }
<?php

require_once '../../../Entity/connexion_db.php';
session_start();
$bdd = connexion_db::getInstance();
if ($_SESSION['admin'] == false) {
    header('location: ../index.php');
}
?>


<html lang="en">
<head>
    <link rel="stylesheet" type="text/css" href="../../../css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="../../../css/style.css">
    <link rel="stylesheet" type="text/css" href="../../../css/aero.css">
    <meta charset="UTF-8">
    <title>administrateur</title>
</head>
<body>
<?php 
include '../navbar.html';
?>

<div class="container marketing">

    <div class="row">
        <div class="col-lg-4 destination liste-vols">
            <h2 class="titre">Bienvenue dans l'interface administrateur</h2>
            <p><a class="btn btn-default" href="ajoutCompagnie.php" role="button">Ajouter compagnie &raquo;</a></p>
            <table class="table table-striped dest-table">
 function addReserve($user, $vol, $nbplaces, $prixtotal)
 {
     $bdd = connexion_db::getInstance();
     $bdd->exec("INSERT INTO reserve (id_vol, id_usr, nbplaces, prixtotal) VALUES (" . $vol . ", " . $user . ", " . $nbplaces . ", " . $prixtotal . ")");
 }
Example #4
0
 function updateVol($field, $value, $id)
 {
     $bdd = connexion_db::getInstance();
     $bdd->exec("UPDATE vol SET " . $field . "=" . $value . "WHERE id_vol=" . $id . "");
 }
 function updateCompagnie($nom, $logo, $id)
 {
     $bdd = connexion_db::getInstance();
     $bdd->exec("UPDATE compagnie SET libelle_comp='" . $nom . "', logo_comp='" . $logo . "' WHERE id_comp = " . $id . ";");
 }
 function updateDestination($nom, $photo, $description, $id)
 {
     $bdd = connexion_db::getInstance();
     $bdd->exec("UPDATE destination SET libelle_dest = '" . $nom . "', description_dest = '" . $description . "',image_dest = '" . $photo . "' WHERE id_dest =" . $id . ";");
 }
 function getUtilisateurById($id)
 {
     $bdd = connexion_db::getInstance();
     $req = $bdd->query("SELECT * FROM utilisateur WHERE id_usr = '******'");
     $user = $req->fetch();
     $utilisateur = new utilisateur($user['nom_usr'], $user['prenom_usr'], $user['mail_usr'], $user['civilite_usr'], $user['date_usr'], $user['login'], $user['password']);
     return $utilisateur;
 }
 function updateAeroport($libelle, $id)
 {
     $bdd = connexion_db::getInstance();
     $bdd->exec("UPDATE aeroport SET libelle_aero='" . $libelle . "' WHERE id_aero =" . $id . ";");
 }