-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.php
152 lines (134 loc) · 5.53 KB
/
signup.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
/** @var mysqli $db */
//Check if Post isset, else do nothing
if (isset($_POST['submit'])) {
//Require database in this file & image helpers
require_once "database.php";
//Postback with the data showed to the user, first retrieve data from 'Super global'
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$mail = $_POST['mail'];
$number = $_POST['number'];
$password = $_POST['password'];
//Require the form validation handling
require_once "form-validation2.php";
$db = mysqli_connect(
hostname: 'localhost',
username: 'root',
password: '',
database: 'reserveringssysteem'
);
if (empty($errors)) {
$password = password_hash($password, PASSWORD_DEFAULT);
//Save the record to the database
$query = "INSERT INTO registreer (first_name, last_name, mail,number,password)
VALUES ('$first_name','$last_name','$mail','$number','$password')";
$result = mysqli_query($db, $query) or die('Error: ' . mysqli_error($db) . ' with query ' . $query);
//Close connection
mysqli_close($db);
// Redirect to index.php
header('Location: index.html');
exit;
}
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
<title>Register - Create</title>
</head>
<body>
<div class="container px-4">
<h1 class="title mt-4">Registreren</h1>
<section class="columns">
<form class="column is-6" action="" method="post">
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label" for="name">Voornaam</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<input class="input" id="name" type="text" name="first_name"
value="<?= $first_name ?? '' ?>"
required/>
</div>
<p class="help is-danger">
<?= $errors['first_name'] ?? '' ?>
</p>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label" for="name">Achternaam</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<input class="input" id="last_name" type="text" name="last_name"
value="<?= $last_name ?? '' ?>" required/>
</div>
<p class="help is-danger">
<?= $errors['Last_name'] ?? '' ?>
</p>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label" for="mail">E-mail</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<input class="input" id="genre" type="text" name="mail" value="<?= $mail ?? '' ?>"
required/>
</div>
<p class="help is-danger">
<?= $errors['mail'] ?? '' ?>
</p>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label" for="number">Telefoonnummer</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<input class="input" id="number" type="text" name="number"
value="<?= $number ?? '' ?>" required/>
</div>
<p class="help is-danger">
<?= $errors['number'] ?? '' ?>
</p>
</div>
</div>
</div>
<div class="field-body">
<div class="field">
<label class="label">wachtwoord</label>
<div class="control">
<input class="input" id="password" type="password" name="password" required/>
</div>
<p class="help is-danger">
<?= $errors['password'] ?? '' ?>
</p>
</div>
</div>
<div class="control">
<button type="submit" name="submit" class="button is-dark">Sign up</button>
</div>
</form>
</section>
</div>
<a class="button mt-4" href="index.html">« terug naar home</a>
</body>
</html>