Advertisement
Guest User

Untitled

a guest
Mar 5th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.98 KB | None | 0 0
  1. <?php
  2. require ("connection.php");
  3.  
  4. $query = $dbConnection->prepare("select country_name from Country");
  5. $query->execute();
  6. $countrys = $query->fetchAll(PDO::FETCH_COLUMN);
  7.  
  8. $error = '';
  9. $patroonUser = '/^[a-zA-Z]{1,12}$/';
  10. $patroonPass = '/^(?=.*\d)(?=.*[@#\-_.$%^&+=§!\?])(?=.*[a-z])(?=.*[A-Z])[0-9A-Za-z@#\-_.$%^&+=§!\?]{6,12}$/';
  11.  
  12. if (isset($_POST['submit'])) {
  13. if (empty($_POST['email']) || empty($_POST['gebruikersnaam']) || empty($_POST['wachtwoord']) || empty($_POST['wachtwoordcheck']) && empty($_POST['geslacht'])
  14. && empty($_POST['geboortedatum']) && empty($_POST['Land']) && empty($_POST['abbonementType'])) {
  15. $error = "vul alle velden in";
  16. } else {
  17. if (preg_match($patroonUser,$_POST['gebruikersnaam']) && preg_match($patroonPass,$_POST['wachtwoord']) && preg_match($patroonUser,$_POST['voornaam']) &&
  18. preg_match($patroonUser,$_POST['achternaam'])) {
  19. if ($_POST['wachtwoord'] === $_POST['wachtwoordcheck']) {
  20.  
  21. $error = '';
  22. $email = $_POST['email'];
  23. $gebruikersnaam = $_POST['gebruikersnaam'];
  24. $query = "select Customer_mail_adress from Customer where customer_mail_adress ='$email' or user_name = '$gebruikersnaam'";
  25.  
  26. $statement = $dbConnection->prepare($query, array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));
  27. $statement->execute();
  28. $rowCount = $statement->rowCount();
  29.  
  30. if ($rowCount == 0) {
  31. $voornaam = $_POST["voornaam"];
  32. $achternaam = $_POST["achternaam"];
  33. $gebruikersnaam = $_POST["gebruikersnaam"];
  34. $cost = rand(10, 20);
  35. $wachtwoordhash = password_hash($_POST["wachtwoord"], PASSWORD_DEFAULT);
  36. $geslacht = $_POST["geslacht"];
  37. $geboortedatum = $_POST["geboortedatum"];
  38. $land = $_POST["land"];
  39. $contractType = $_POST["contractType"];
  40. $date = date("Y-m-d");
  41.  
  42. $sql = "insert into customer(firstname,lastname,customer_mail_adress, user_name, password,gender,birth_date,country_name,
  43. contract_type,subscription_start) values(?,?,?,?,?,?,?,?,?,?)";
  44. $query = $dbConnection->prepare($sql);
  45. $query->execute(array(
  46. $voornaam, $achternaam, $email,
  47. $gebruikersnaam, $wachtwoordhash,
  48. $geslacht, $geboortedatum,
  49. $land, $contractType, $date
  50. ));
  51. header("Location: film_pagina.php?genre=Actie");
  52. } else {
  53. $error = 'email of gebruikersnaam bestaat al';
  54. }
  55. } else {
  56. $error = 'wachtwoord komt niet overeen';
  57. }
  58. } else{
  59. $error = 'controleer velden';
  60. }
  61.  
  62. }
  63. }
  64. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement