Your IP : 216.73.216.162


Current Path : /home/xbodynamge/namtation/reservation/
Upload File :
Current File : /home/xbodynamge/namtation/reservation/action_annuler.php

<?php
include_once('./inc/init.inc.php');
include_once('./inc/secure.inc.php');


$sql = "SELECT * from reservation".$DB_prefixtable."reservation where id =".$_GET['id']; 
$req = mysqli_query($db, $sql) or die('Erreur SQL !'.mysqli_error());
$reservation = mysqli_fetch_assoc($req);

if ($reservation['id_client']!=$_SESSION['id_client']){
header('Location: reservation.php'); 
}
else{
if ($reservation['date']==date('Y-m-d')){
	header('Location: reservation.php?message=7');  

}
else{

        

	try {
		$transactDB = new PDO("mysql:host=".$DB_server.";dbname=".$DB_dbname, $DB_login, $DB_pass);
		$transactDB->beginTransaction();
		
		$transactDB->query("delete from reservation".$DB_prefixtable."reservation where id = ".$_GET['id']." and id_client = ".$_SESSION['id_client']);
		$transactDB->query("update reservation".$DB_prefixtable."client set nb_seance=nb_seance+1 where id=".$_SESSION['id_client']);
		
		$transactDB->commit();
	} catch (Exception $e) {
		$transactDB->rollback();
	}
	header('Location: reservation.php?message=2');  

}
}

mysql_close(); 
?>