Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.85 KB | None | 0 0
  1. <?php
  2. $error = '';
  3. $nom = ''; // C'est Fait
  4. $prenom = ''; // C'est Fait
  5. $entreprise = ''; // C'est Fait
  6. $telephone = ''; // C'est Fait
  7. $message = ''; // EN COURS
  8. $accept = ''; // ???
  9. $submit = ''; // PAS FAIT
  10.  
  11. function clean_text ($string){
  12. $string = trim($string);
  13. $string = stripslashes($string);
  14. $string = htmlspecialchars($string);
  15. return $string;
  16. }
  17.  
  18. if (isset($_POST["submit"])) {
  19. if (empty($_POST["nom"])) {
  20. $error .= '<p><label class = "text-probleme">Entrez votre nom s il vous plait</label></p>';
  21. } else {
  22. $nom = clean_text($_POST["nom"]);
  23. if (!preg_match("/^[a-zA-Z ]*$/", $nom)) {
  24. $error .= '<p><label class = "text-probleme">Seulement les lettres et les espaces sont autorisé</label></p>';
  25. }
  26. }
  27. if (empty($_POST["prenom"])) {
  28. $error .= '<p><label class = "text-probleme">Entrez votre prenom s il vous plait</label></p>';
  29. } else {
  30. $prenom = clean_text($_POST["prenom"]);
  31. if (!preg_match("/^[a-zA-Z ]*$/", $prenom)) {
  32. $error .= '<p><label class = "text-probleme">Seulement les lettres et les espaces sont autorisé</label></p>';
  33. }
  34. }
  35. if (empty($_POST["email"])) {
  36. $error .= '<p><label class = "text-probleme">Entrez votre adresse email s il vous plait</label></p>';
  37. } else {
  38. $email = clean_text($_POST["email"]);
  39. if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
  40. $error .= '<p><label class = "text-probleme>Le format de votre adresse email est inconnu</label>"</p>';
  41. }
  42. }
  43. if (empty($_POST["entreprise"])) {
  44. $error .= '<p><label class = "text-probleme">Entrez le nom de votre entreprise</label></p>';
  45. } else {
  46. if (!preg_match("/^[a-zA-Z ]*$/", $prenom)) {
  47. $error .= '<p><label class = "text-probleme">Le format de lettre de votre entreprise est inconnu (des lettres de A à Z avec des espaces sont uniquement autorisé</label></p>';
  48. }
  49. if (empty($_POST["telephone"])) {
  50. $error .= '<p><label class = "text-probleme">Entrez votre numéro de téléphone s il vous plait</label></p>';
  51. } else {
  52. if (!preg_match("/^[0-9 ]*$/", $telephone)) {
  53. $error .= '<p><label class = "text-probleme">Le format de votre numéro de téléphone est inconnu, entrez des chiffres entre 0 et 9</label></p>';
  54. }
  55. }
  56. if (empty($_POST["message"])) {
  57. $error .= '<p><label class = "text-probleme">Veuillez entrez un message pour vous présentez en quelque mot</label></p>';
  58. } else {
  59. $message = clean_text($_POST["message"]);
  60. }
  61. if ($error == '') {
  62. $file_open = fopen("contact_data.csv", "a");
  63. $no_rows = count(file("contact_data.csv"));
  64. if ($no_rows > 1) {
  65. $no_rows = ($no_rows - 1) + 1;
  66. }
  67. $form_data = array(
  68. 'sr_no' => $no_rows,
  69. 'nom' => $nom,
  70. 'prenom' => $prenom,
  71. 'entreprise' => $entreprise,
  72. 'telephone' => $telephone,
  73. 'message' => $message
  74. );
  75. fputcsv($file_open, $form_data);
  76. $error .= '<p><label class = "text-probleme">Merci de vous être inscrit au Five, vous êtes maintenant connecter a la nouvelle innovation.</label></p>';
  77. $nom = '';
  78. $prenom = '';
  79. $entreprise = '';
  80. $telephone = '';
  81. $message = '';
  82. }
  83.  
  84. }
  85.  
  86.  
  87.  
  88. ?>
  89. <!DOCTYPE html>
  90. <html>
  91. <head>
  92. <title>Le Bidule - Accueil</title>
  93. <meta charset="utf-8">
  94. <link rel="stylesheet" type="text/css" href="css/styles.css">
  95. <script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
  96. <script src = "https://maxcdn.bootstarpcdn.com/bootstarp/3.3.7/js/bootstrap.min.js"></script>
  97. </head>
  98.  
  99. <body>
  100. <section id = "main">
  101. <a href = "https://www.facebook.com/LeFive-202874746825195/" target = "_blank"><img class = "logo" src="Images/logo_LE FIVE 1.png"alt="logo du five, avec un liens vers la page facebook"/></a>
  102. <!--<nav class = "button">
  103. <ul>
  104. <a href="index.html" class = "boutton">Acceuil<li></li></a>
  105. <a href="social.html" class = "boutton">Réseaux Sociaux<li></li></a>
  106. <a href="photos.html" class = "boutton">Photos<li></li></a>
  107. <a href="contact.html" class = "boutton"><li>Contact</li></a>
  108. </ul>
  109. </nav>-->
  110. </section>
  111.  
  112. <section class = "animation-css">
  113. <video class = "video" controls>
  114. <source src="Vidéo/vine.mp4" autoplay>
  115. </video>
  116. <br><br><br><br><br>
  117. </section>
  118. <h1 class = "insc">Connecter vous a l'innovation !</h1>
  119. <p class = "inscri">Inscrivez-vous au fab-lab de Vitré.</p>
  120. <section class = "formulaire"> <!--Mettre les informations du formulaire dans la base de données-->
  121. <form id = "form" method = "post" action = "mail.php">
  122. <?php echo $error; ?>
  123. <input id = "form" type="text" placeholder = "Nom" name = "nom" required value="<?php echo $nom; ?>"><br>
  124. <input id = "form" type="text" placeholder = "Prénom" name = "prenom" required value="<?php echo $prenom; ?>" ><br>
  125. <input id = "form" type="text" placeholder = "Entreprise" name = "entreprise" required value= "<?php echo $entreprise; ?>"><br>
  126. <input id = "form" type = "text" placeholder = "Entrez votre adresse email" name = "email" required value="<?php echo $email; ?>"><br>
  127. <input id = "form" type="number" placeholder = "Numéro de téléphone" name = "telephone" required value="<?php echo $telephone; ?>"><br>
  128. <input id = "form" type="text" placeholder = "Ecrivez un message pour vous présentez en quelque ligne....." name="message" required value="<?php echo $message; ?>"><br>
  129. ACCEPTEZ LES NEWS ? <input id = "form" type="checkbox" name="eccept" required><br><br>
  130. <input type="submit" name="Envoyer"><input type="reset" name="effacer">
  131. </form>
  132. <br><br><br><br>
  133. </section>
  134. <section class = "copyright">
  135. <br>
  136. <p id = "copyright-fr">© Fab-Lab Le Five - All rights reserved © 2017-2019</p>
  137. <p id = "copyright-en">© Fab-Lav Le Five - Tous les droits sont réservés © 2017-2019</p>
  138. <p id = "copyright-es">© Fab-Lab Le Five - Todos los derechos están reservados © 2017-2019</p>
  139. </section>
  140. </body>
  141. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement