Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_POST['submit'])) {
- $username = htmlentities(trim($_POST['username']));
- $password = htmlentities(trim($_POST['password']));
- $repeatpassword = htmlentities(trim($_POST['repeatpassword']));
- if (isset($username) && isset($password) && isset($repeatpassword)) {
- if ($password == $repeatpassword) {
- $bdd = new PDO('mysql:host=localhost;dbname=phplogin', 'root', 'root');
- $bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $req = $bdd->prepare("INSERT INTO user (username, password) VALUES (:username, :password)");
- $req->execute(array(
- "username" => $username,
- "password" => $password,
- ));
- $reponse = $bdd->query('SELECT * FROM user');
- die("Inscription terminée,connéctez vous");
- } else echo "Les deux mots de passe doivent être identique";
- } else echo "Veuillez saisir tout les champs";
- }
- ?>
Add Comment
Please, Sign In to add comment