= 1; } session_start(); require_once("../connexionBD.php"); require_once("../ressources/user.php"); //Si on est pas connecté redirection vers la page de connexion if (!isset($_SESSION['mail'])) { header('Location: ../index.php'); exit(); } $mail = $_SESSION['mail']; if (isset($_POST['codetrajet']) && isset($_POST['avislaisse']) && isset($_POST['note'])) { $avis = $_POST['avislaisse']; $note = $_POST['note']; $codetrajet = intval($_POST['codetrajet']); $date = date('Y-m-d H:i:s'); if (checkAvis($db, $mail, $codetrajet) && checkCodeTrajetAvis($db, $mail, $codetrajet)) { $requete = "INSERT INTO avis (mailemetteur, codetrajet, commentaire, dateavis, note, estlu) VALUES ($1,$2,$3,$4,$5, false);"; $envoi = pg_query_params($db, $requete, array($mail, $codetrajet, $avis, $date, $note)); if (!$envoi) { echo "Erreur d'ecriture dans la BD"; exit(); } else { header('Location: ../index.php'); exit(); } } } ?>