Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $password = $_POST['wachtwoord'];
- $hash = password_hash($_POST['wachtwoord'], PASSWORD_DEFAULT);
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "bibliotheek";
- if($_POST['wachtwoord'] === $_POST['wachtwoordb']){
- $query= "SELECT naam FROM klant WHERE naam = ' " . $_POST['naam'] . " ' ";
- $query_res = $conn->query($query);
- $count= count($query_res->fetchAll());
- if($count > 0){
- echo "Gebruikersnaam al in gebruik";
- }
- else{
- $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
- // set the PDO error mode to exception
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $sql="INSERT INTO klant(naam, woonplaats, adres, postcode, telefoonnummer, wachtwoord, rol ) VALUES (:naam, :woonplaats, :adres, :postcode, :telefoonnummer, '$hash', 'klant')";
- $query = $conn->prepare($sql);
- $query->bindValue(':naam', $_POST['naam']);
- $query->bindValue(':woonplaats', $_POST['woonplaats']);
- $query->bindValue(':adres', $_POST['adres']);
- $query->bindValue(':postcode', $_POST['postcode']);
- $query->bindValue(':telefoonnummer', $_POST['telefoonnummer']);
- $query->execute();
- echo "<div class='voltooidtekst'>";
- echo "Uw gegevens zijn geregistreerd! Bedankt voor uw tijd.";
- echo "</div>";
- };
- }
- else{
- echo "<div class='vt'>";
- echo "Uw wachtwoorden komen niet overeen.";
- echo "</div>";
- echo "<a href='signup.php'><input type='submit' name='terug' class='tknop' value='Klik op deze knop om terug te gaan naar het registratie formulier. LET OP! Vul 2x hetzelfde wachtwoord in. '></a>";
- };
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement