-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck.php
More file actions
102 lines (51 loc) · 2.06 KB
/
check.php
File metadata and controls
102 lines (51 loc) · 2.06 KB
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
<?php
require ('checkuser.php');
require ('createuser.php');
$firstname = htmlspecialchars(strip_tags($_POST['reg_firstname']));
$lastname = htmlspecialchars(strip_tags($_POST['reg_lastname']));
$email = htmlspecialchars(strip_tags($_POST['reg_email']));
$username = htmlspecialchars(strip_tags($_POST['reg_usn']));
$password = htmlspecialchars(strip_tags($_POST['reg_pwd']));
$password_confirm = htmlspecialchars(strip_tags($_POST['reg_pwd_confirm']));
//Check for blank values
if (!$email || !$username || !$password || !$password_confirm) {
header('Location: register.php?code=empty');
exit;
}
//Check for matching password fields
if ($password != $password_confirm) {
header('Location: register.php?code=pwd_mismatch');
exit;
}
//Check for valid email
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
header('Location: register.php?code=einvalid');
exit;
}
//Check for valid length of password
if (strlen($password) < 9) {
header('Location: register.php?code=pwdshort');
exit;
}
//Check for existing username
$results = check_user($username);
if ($results == "1") {
header('Location: register.php?code=usrexists');
exit;
}
$success = create_user($firstname, $lastname, $email, $username, $username, $password);
if ($success) {
if (!file_exists("./User Directories/$username")) {
mkdir("./User Directories/$username");
mkdir("./User Directories/$username/Application");
mkdir("./User Directories/$username/Compressed");
mkdir("./User Directories/$username/Misc");
mkdir("./User Directories/$username/Utility");
}
echo "<html><head><link href='site.css' rel='stylesheet' type='text/css'></head><body id='create_body'><div id='create_div'>";
echo "User successfully created!<br />";
echo "<br />";
echo "Please click here to login: <a href='index.php'><ul>Login here</ul></a>";
echo "</body></div></html>";
}
?>