Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.84 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <html>
  4. <head>
  5. <meta charset="utf-8" />
  6. <title>Arcade Trader</title>
  7. <link rel="shortcut icon" type="image/png" href="https://upload.wikimedia.org/wikipedia/commons/4/4d/E-megasport.com_-_favicon.png"/>
  8. <link rel="stylesheet" href="Projet.css" />
  9. </head>
  10.  
  11. <body>
  12. <fieldset>
  13. <legend>Se connecter</legend>
  14. <label>E-mail ou pseudo : </label><input type="text" name="pseudo">
  15. <label>Mot de passe : </label><input type="text" name="mdp"><br />
  16. </fieldset>
  17. <br /><br />
  18. <h1>Arcade Trader</h1>
  19. <br /><br />
  20. <h2 id="accueil">Accueil</h2>
  21. <h2>Acheter</h2>
  22. <h2><a href="Annonce.php#annonce" class="elembandeau" title="Vendre">Créer une annonce</a></h2>
  23. <h2>Aide</h2>
  24. <br /><br />
  25.  
  26. <form action="Projet.php" method="post">
  27. <select name="categorie" size="1" class="decal">
  28. <option selected disabled value="disabled">Choisir une catégorie</option>
  29. <option value="jv">Console et Jeu vidéo</option>
  30. <option value="figurine">Figurine, Peluche et Jouet</option>
  31. <option value="film">Film et Animation</option>
  32. <option value="societe">Jeu de société</option>
  33. <option value="livre">Livre</option>
  34. <option value="autre">Autre</option>
  35. </select>
  36. <input placeholder="Nom de la ville" type="text" name="ville" />
  37. <input placeholder="Nom de l'article (ou mot-clé)" type="text" name="recherche" />
  38. <input type="submit" name="rechercher" value="Rechercher" /><br /><br />
  39. </form>
  40.  
  41. <?php
  42. if(isset($_POST['recherche'])) {
  43. $recherche = $_POST['recherche'];
  44. $ville = $_POST['ville'];
  45. $categorie = $_POST['categorie'];
  46. $connect = mysqli_connect("inf-mysql.univ-rouen.fr", "marybtho", "20101999", "marybtho");
  47. echo mysqli_connect_error();
  48. $requete = "SELECT * FROM Annonce WHERE localisation LIKE '%$ville%' AND titre LIKE '%$recherche%' AND categorie LIKE '%$categorie%';";
  49. $res = mysqli_query($connect, $requete);
  50. echo mysqli_error($connect);
  51. if(mysqli_num_rows($res) == 0) {
  52. echo "Aucun résultat trouvé.";
  53. }
  54. if(empty($recherche) && empty($ville) && empty($categorie)) {
  55. echo "Veuillez entrer au moins un critère de recherche.";
  56. } else {
  57. while($tab = mysqli_fetch_array($res)) {
  58. echo "<table>";
  59. echo "<tr><th>{$tab['titre']}</th></tr>";
  60. echo "<tr><td>{$tab['description']}</td></tr>";
  61. echo "</table><br />";
  62. }
  63. }
  64. mysqli_close($connect);
  65. }
  66. ?>
  67. </body>
  68. </html>
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82. <!DOCTYPE html>
  83.  
  84. <html>
  85. <head>
  86. <meta charset="utf-8" />
  87. <title>Arcade Trader</title>
  88. <link rel="shortcut icon" type="image/png" href="https://upload.wikimedia.org/wikipedia/commons/4/4d/E-megasport.com_-_favicon.png"/>
  89. <link rel="stylesheet" href="Vendre.css" />
  90. </head>
  91.  
  92. <body>
  93.  
  94. <?php
  95. $choix = $_POST['choix'];
  96. $categorie = $_POST['categorie'];
  97. $titre = $_POST['titre'];
  98. $description = $_POST['description'];
  99. $postal = $_POST['postal'];
  100. $localisation = $_POST['localisation'];
  101. $telephone = $_POST['telephone'];
  102. $email = $_POST['email'];
  103.  
  104. $connect = mysqli_connect("inf-mysql.univ-rouen.fr", "marybtho", "20101999", "marybtho");
  105. echo mysqli_connect_error();
  106. $requete = "INSERT INTO Annonce VALUES('$titre', '$description', '$categorie', '$postal', '$localisation', '$telephone', '$email')";
  107. mysqli_query($connect, $requete);
  108. echo mysqli_error($connect);
  109. mysqli_close($connect);
  110. ?>
  111.  
  112. <p>
  113. Votre annonce a bien été prise en compte. Vous pouvez la consulter et la modifier à tout moment.
  114. </p>
  115. <p>
  116. Cliquez <a href="Projet.php"><strong>ici</strong></a> pour revenir à l'accueil.
  117. </p>
  118. </body>
  119. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement