| Current Path : /home/x/b/o/xbodynamge/namtation/reservation/dev/ |
| Current File : /home/x/b/o/xbodynamge/namtation/reservation/dev/action_annuler.php |
<?php
include_once('./inc/init.inc.php');
include_once('./inc/secure.inc.php');
$sql = "SELECT * from reservation_reservation where id =".$_GET['id'];
$req = mysql_query($sql) or die('Erreur SQL !'.mysql_error());
$reservation = mysql_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_reservation where id = ".$_GET['id']." and id_client = ".$_SESSION['id_client']);
$transactDB->query("update reservation_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();
?>