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
| <head><style type="text/css">
<!--
.Normal-form
{
font-family:"Times New Roman", serif; font-weight:700; font-size:16.0px; line-height:1.25em; color:#8e741c;
}
-->
</style></head>
<?php
{
$nom_hotel = htmlentities($_POST['nom_hotel']); //On recupère les infos
$ville = htmlentities($_POST['ville']);
$classification = htmlentities($_POST['classification']);
$nom_chaine = htmlentities($_POST['nom_chaine']);
$pseudo = htmlentities($_POST['pseudo']);
$argent = htmlentities($_POST['argent']);
$type= htmlentities($_POST['type']);
$verification = mysql_query("SELECT COUNT(*) FROM pdf_hotel WHERE nom_hotel='$nom_hotel'") or die (mysql_error());
$donnees = mysql_fetch_array($verification)or die (mysql_error());
if($donnees['COUNT(*)'] >= 1) //On verifie que le nom de l'hôtel n'existe pas déjà
{
$reponse = 'Un hôtel porte déjà ce nom là, merci d\'en choisir un nouveau. <a href="javascript:history.back(1)">Retour au formulaire</a>';
}
elseif( empty($nom_hotel)) //On verifie que les variables précédentes ne soient pas vide
{
$reponse = 'Veuillez indiquer un nom pour votre hôtel, <a href="javascript:history.back(1)">Retour au formulaire</a>';
}
else //Si tout est bon on entre les données dans la BDD et on envoye le mail
{
mysql_query("INSERT INTO pdf_hotel VALUES ('','$pseudo', '$nom_chaine', '$nom_hotel', '$type', '$classification', '$ville')");
mysql_query ("UPDATE pdf_membre SET `argent`='$argent' WHERE pseudo='$pseudo'");
$reponse = 'Vous venez de construire un nouvel hôtel.<br>Le maire vous souhaite la bienvenue et de bonnes affaires ! <br><a href="chaine.php">Retour</a>';
}
}
?>
<html>
<body>
<center><span class="Normal-form"><? echo "$reponse"; ?></span></center> <!-- On affiche la reponse de tout le code du dessus -->
</body>
</html> |
Partager