예제 #1
0
<?php

include 'class/requiert.php';
$authentification = new requiert();
$authentification->acces();
if (isset($_POST['submit'])) {
    if (!empty($_GET['site']) and is_numeric($_GET['site']) and !empty($_POST['log']) and is_numeric($_POST['log']) and !empty($_POST['date'])) {
        include_once 'class/info_site.php';
        $info = new info_site($_GET['site']);
        $info->req_exist();
        if ($info->get_result() == 1) {
            include_once 'class/info_sl.php';
            $nb_sl = new info_sl($_GET['site'], $_POST['log']);
            $nb_sl->req_nb();
            $max = $nb_sl->get_data();
            include_once 'class/nb_reserv.php';
            $reserv = new nb_reserv($_POST['date'], $_GET['site'], $_POST['log']);
            $reserv->req_data();
            if ($reserv->get_data() < $max['nb_log_sl']) {
                include_once 'class/info_logement.php';
                $info = new info_logement($_POST['log']);
                $info->req_exist();
                if ($info->get_result() == 1) {
                    // Insérer dans la base de données
                    include_once 'class/add_reservation.php';
                    if (!empty($_POST['pension'])) {
                        $pension = 1;
                    } else {
                        $pension = 0;
                    }
                    if (!empty($_POST['menage'])) {