Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require ("connection.php");
- $query = $dbConnection->prepare("select country_name from Country");
- $query->execute();
- $countrys = $query->fetchAll(PDO::FETCH_COLUMN);
- $error = '';
- $patroonUser = '/^[a-zA-Z]{1,12}$/';
- $patroonPass = '/^(?=.*\d)(?=.*[@#\-_.$%^&+=§!\?])(?=.*[a-z])(?=.*[A-Z])[0-9A-Za-z@#\-_.$%^&+=§!\?]{6,12}$/';
- if (isset($_POST['submit'])) {
- if (empty($_POST['email']) || empty($_POST['gebruikersnaam']) || empty($_POST['wachtwoord']) || empty($_POST['wachtwoordcheck']) && empty($_POST['geslacht'])
- && empty($_POST['geboortedatum']) && empty($_POST['Land']) && empty($_POST['abbonementType'])) {
- $error = "vul alle velden in";
- } else {
- if (preg_match($patroonUser,$_POST['gebruikersnaam']) && preg_match($patroonPass,$_POST['wachtwoord']) && preg_match($patroonUser,$_POST['voornaam']) &&
- preg_match($patroonUser,$_POST['achternaam'])) {
- if ($_POST['wachtwoord'] === $_POST['wachtwoordcheck']) {
- $error = '';
- $email = $_POST['email'];
- $gebruikersnaam = $_POST['gebruikersnaam'];
- $query = "select Customer_mail_adress from Customer where customer_mail_adress ='$email' or user_name = '$gebruikersnaam'";
- $statement = $dbConnection->prepare($query, array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));
- $statement->execute();
- $rowCount = $statement->rowCount();
- if ($rowCount == 0) {
- $voornaam = $_POST["voornaam"];
- $achternaam = $_POST["achternaam"];
- $gebruikersnaam = $_POST["gebruikersnaam"];
- $cost = rand(10, 20);
- $wachtwoordhash = password_hash($_POST["wachtwoord"], PASSWORD_DEFAULT);
- $geslacht = $_POST["geslacht"];
- $geboortedatum = $_POST["geboortedatum"];
- $land = $_POST["land"];
- $contractType = $_POST["contractType"];
- $date = date("Y-m-d");
- $sql = "insert into customer(firstname,lastname,customer_mail_adress, user_name, password,gender,birth_date,country_name,
- contract_type,subscription_start) values(?,?,?,?,?,?,?,?,?,?)";
- $query = $dbConnection->prepare($sql);
- $query->execute(array(
- $voornaam, $achternaam, $email,
- $gebruikersnaam, $wachtwoordhash,
- $geslacht, $geboortedatum,
- $land, $contractType, $date
- ));
- header("Location: film_pagina.php?genre=Actie");
- } else {
- $error = 'email of gebruikersnaam bestaat al';
- }
- } else {
- $error = 'wachtwoord komt niet overeen';
- }
- } else{
- $error = 'controleer velden';
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement