forked from jribbers/cvcreate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathregistration.php
69 lines (55 loc) · 1.63 KB
/
registration.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
include 'inc/package.php';
include '/inc/classes/user.php';
define('PAGE_TITLE', 'Registration');
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
$additionalCSS = ['registration'];
if(isSet($_POST['register'])){
$error = '';
$succes = '';
$areSet = [
'username' => false,
'email' => false,
'password' => false
];
if(isSet($_POST['username'])){
$areSet['username'] = $_POST['username'];
} else {
$error .= 'Gebruikersnaam is een vereist veld. Vul deze a.u.b. in.';
}
if(isSet($_POST['email'])){
if(filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) == true){
$areSet['email'] = $_POST['email'];
} else {
$error .= 'Email is ongeldig. Vul a.u.b. een geldig email adres in.';
}
} else {
$error .= 'Email is een vereist veld. Vul deze a.u.b. in.';
}
if(strlen($_POST['password']) > 6){
if(isSet($_POST['password']) && $_POST['passwordConf'] === $_POST['password']){
$areSet['password'] = $_POST['password'];
} else {
$error .= 'Wachtwoorden komen niet overeen.';
}
} else {
$error .= 'Wachtwoord is te kort. Het moet op zijn minst 7 karakters lang zijn.';
}
$complete = true;
foreach($areSet as $key => $value){
if($value == false){
$complete = false;
} else {
$complete = true;
}
}
if($complete == true){
$newUser = new User(true, $areSet);
$succes .= 'Er is een bevestigingsmail naar uw email verzonden.';
}
}
$view = 'views/registration.php';
include $template;
?>