-
Notifications
You must be signed in to change notification settings - Fork 0
/
reg_process.php
58 lines (52 loc) · 1.29 KB
/
reg_process.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
<?php
include 'dbh.php';
$first = $_POST['voornaam'];
$last = $_POST['achternaam'];
$pwd = $_POST['pwd'];
$r_pwd = $_POST['r_pwd'];
$id_nummer = strtoupper($_POST['id_nummer']);
if(empty($first)){
header("Location: ../test/register.php?error=empty");
exit();
}
if(empty($last)){
header("Location: ../test/register.php?error=empty");
exit();
}
if(empty($pwd)){
header("Location: ../test/register.php?error=empty");
exit();
}
if(empty($r_pwd)){
header("Location: ../test/register.php?error=empty");
exit();
}
if(empty($id_nummer)){
header("Location: ../test/register.php?error=empty");
exit();
}
if ($pwd !== $r_pwd) {
header("Location: ../test/register.php?error=match");
exit();
}
if (strlen($id_nummer) !== 8) {
header("Location: ../test/register.php?error=short");
exit();
}
else{
$sql = "SELECT id_nummer FROM user_info WHERE id_nummer = '$id_nummer' ";
$result = $conn ->query($sql);
$idnmrcheck = mysqli_num_rows($result);
if ($idnmrcheck > 0) {
header("Location: ../test/register.php?error=idnmr");
exit();
}else {
//password encryption
$enc_pwd = password_hash($pwd, PASSWORD_DEFAULT);
$sql = "INSERT INTO user_info (id_nummer,pwd,voornaam,achternaam)
VALUES ('$id_nummer','$enc_pwd','$first','$last')";
$result = $conn->query($sql);
header('Location: index.php');
}
}
?>