-
Notifications
You must be signed in to change notification settings - Fork 0
/
userRegister.inc.php
49 lines (39 loc) · 1.24 KB
/
userRegister.inc.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
<?php
require_once('dbh.inc.php');
require_once('functions.inc.php');
$name = $_POST["name"];
$email = $_POST["email"];
$phone = $_POST["phone"];
$pwd = $_POST["pwd"];
$repwd = $_POST["repwd"];
if (isset($_POST["submit"])) {
if (userRegisterEmptyInput($name, $email, $phone, $pwd, $repwd) !== false) {
header("location: ../user/main/register.php?error=emptyInput");
exit();
}
if (invaliduName($name) !== false) {
header("location: ../user/main/register.php?error=invaliduName");
exit();
}
if (invalidEmail($email) !== false) {
header("location: ../user/main/register.php?error=invalidEmail");
exit();
}
if (invalidPwd($pwd) == false) {
header("location: ../user/main/register.php?error=invalidPwd");
exit();
}
if (pwdMatch($pwd, $repwd) !== false) {
header("location: ../user/main/register.php?error=pwdDontMatch");
exit();
}
if (useruNameEmailExists($conn, $name, $email) !== false) {
header("location: ../user/main/register.php?error=uNameTaken");
exit();
} else {
userRegister($conn, $name, $email, $phone, $pwd);
}
} else {
header("location: ../user/main/register.php");
exit();
}