1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
   | <?php
	$nom = "";
	$prenom = "";
	$email = "";
	$phone = "";
	$adresse = "";
	$ville = "";
	$cp = "";
	$country = "";
	$room = "";
	$DateStartFR = "";
	$DateStartISO = "";
	$DateEndFR = "";
	$DateEndISO = "";
	$nbnuits = "";
	$nbpersonnes = "";
	$message = "";
	$date_reserv = "";
	$msgErreurCourriel = "";
 
	if(!empty($_POST)){
		$nom = $_POST['nom'];
			$nom = (htmlspecialchars($nom, ENT_QUOTES));
		$prenom = $_POST['prenom'];
			$prenom = (htmlspecialchars($prenom, ENT_QUOTES));
		$email = $_POST['email'];
			$email = (htmlspecialchars($email, ENT_QUOTES));
				$aroba = strpos($email,'@');
				$point = strpos($email,'.');
		$phone = $_POST['phone'];
			$phone = (htmlspecialchars($phone, ENT_QUOTES));
		$adresse = $_POST['adresse'];
			$adresse = (htmlspecialchars($adresse, ENT_QUOTES));
		$ville = $_POST['ville'];
			$ville = (htmlspecialchars($ville, ENT_QUOTES));
		$cp = $_POST['cp'];
			$cp = (htmlspecialchars($cp, ENT_QUOTES));
		$country = $_POST['country'];
			$country = (htmlspecialchars($country, ENT_QUOTES));
		$room = $_POST['room'];
			$room = (htmlspecialchars($room, ENT_QUOTES));
		$DateStartFR = $_POST['DateStartFR'];
			$DateStartFR = (htmlspecialchars($DateStartFR, ENT_QUOTES));
		$DateStartISO = $_POST['DateStartISO'];
			$DateStartISO = (htmlspecialchars($DateStartISO, ENT_QUOTES));
		$DateEndFR = $_POST['DateEndFR'];
			$DateEndFR = (htmlspecialchars($DateEndFR, ENT_QUOTES));
		$DateEndISO = $_POST['DateEndISO'];
			$DateEndISO = (htmlspecialchars($DateEndISO, ENT_QUOTES));
		$nbnuits = $_POST['nbnuits'];
			$nbnuits = (htmlspecialchars($nbnuits, ENT_QUOTES));
		$nbpersonnes = $_POST['nbpersonnes'];
			$nbpersonnes = (htmlspecialchars($nbpersonnes, ENT_QUOTES));
		$message = $_POST['message'];
			$message = (htmlspecialchars($message, ENT_QUOTES));
		$date_reserv = $_POST['date_reserv'];
			$date_reserv = (htmlspecialchars($date_reserv, ENT_QUOTES));
		if(($email != "") && ($point != "") && ($aroba != ""));
		// On vérifie que le champ website est vide
		if (isset($_POST['website']) AND empty($_POST['website']))
		// Alors on continue d'enregistrer les données
		{
 
			$host = "xxxxxxxxxxx.db.1and1.com";
			$user = "xxxxxxxxxxx";
			$bdd  = "xxxxxxxx6";
			$pass = "xxxxxxxx";
 
			mysqli_connect($host, $user, $pass);
			mysqli_select_db($bdd);
			mysqli_query("SET NAMES UTF8");
 
			$SQL = "INSERT INTO reservation (nom, prenom, email, phone, adresse, ville, cp, country, room, DateStartISO, DateEndISO, nbnuits, nbpersonnes, message, date_reserv) VALUES ('$nom', '$prenom', '$email', '$phone', '$adresse', '$ville', '$cp', '$country', '$room', '$DateStartISO', '$DateEndISO', '$nbnuits', '$nbpersonnes', '$message', CURDATE())";
			$req = mysqli_query($SQL) or die("Erreur : " . $SQL); | 
Partager