Guest User

Untitled

a guest
May 14th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. if (isset($_POST['submit'])) {
  5. $username = htmlentities(trim($_POST['username']));
  6. $password = htmlentities(trim($_POST['password']));
  7. $repeatpassword = htmlentities(trim($_POST['repeatpassword']));
  8. if (isset($username) && isset($password) && isset($repeatpassword)) {
  9. if ($password == $repeatpassword) {
  10. $bdd = new PDO('mysql:host=localhost;dbname=phplogin', 'root', 'root');
  11. $bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  12.  
  13. $req = $bdd->prepare("INSERT INTO user (username, password) VALUES (:username, :password)");
  14. $req->execute(array(
  15. "username" => $username,
  16. "password" => $password,
  17. ));
  18. $reponse = $bdd->query('SELECT * FROM user');
  19.  
  20. die("Inscription terminée,connéctez vous");
  21. } else echo "Les deux mots de passe doivent être identique";
  22. } else echo "Veuillez saisir tout les champs";
  23. }
  24.  
  25.  
  26.  
  27.  
  28. ?>
Add Comment
Please, Sign In to add comment