Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. <?php
  2.  
  3. include'db/connexiondb.php';
  4.  
  5. if(isset($_POST['valider']) AND $_POST['valider']) {
  6. $nom = $_POST['nom'];
  7. $prenom = $_POST['prenom'];
  8. $email = $_POST['email'];
  9. $mdp = sha1($_POST['mdp']);
  10. $id_destinataire = $bdd->prepare('SELECT email FROM images WHERE email = ?');
  11. $id_destinataire->execute(array($email));
  12. $dest_exist = $id_destinataire->rowCount();
  13. if($dest_exist == 0) {
  14. if(filter_var($email, FILTER_VALIDATE_EMAIL)) {
  15. $req = $bdd->prepare("INSERT INTO images (nom, prenom, email, mdp) VALUES (?,?,?,?)");
  16. $req->execute(array($nom, $prenom, $email, $mdp));
  17. } else {
  18. echo "Extension Adresse Mail mauvaise";
  19. }
  20. } else {
  21. echo "E-Mail déja Utilisé";
  22. }
  23. }
  24.  
  25. if(isset($_POST['co']) AND $_POST['co']) {
  26. $requser = $bdd->prepare("SELECT * FROM images WHERE id = ?");
  27. $requser->execute(array($_SESSION['id']));
  28. $user = $requser->fetch();
  29. $emailco = $_POST['emailco'];
  30. $mdpco = sha1($_POST['mdpco']);
  31. $requser = $bdd->prepare("SELECT * FROM images WHERE email = ? AND mdp = ?");
  32. $requser->execute(array($emailco, $mdpco));
  33. $userexist = $requser->rowCount();
  34. if($userexist == 1) {
  35. echo "c bon";
  36. }
  37. }
  38.  
  39. ?>
  40.  
  41. <!DOCTYPE html>
  42. <html>
  43. <head>
  44. <title></title>
  45. </head>
  46. <body>
  47. <div align="left">
  48. <form method="POST">
  49. <input type="text" placeholder="Nom" name="nom">
  50. <br/>
  51. <input type="text" placeholder="Prénom" name="prenom">
  52. <br/>
  53. <input type="text" placeholder="E-Mail" name="email">
  54. <br/>
  55. <input type="password" placeholder="Mot De Passe" name="mdp">
  56. <br/>
  57. <input type="submit" value="Inscription" name="valider">
  58. </form>
  59. </div>
  60. <div align="center">
  61. <form method="POST">
  62. <input type="email" name="emailco">
  63. <br/>
  64. <input type="password" name="mdpco">
  65. <br/>
  66. <input type="submit" value="Connexion" name="co">
  67. </form>
  68. </div>
  69. </body>
  70. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement