-
Notifications
You must be signed in to change notification settings - Fork 4
/
add_account.php
100 lines (96 loc) · 2.91 KB
/
add_account.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
<?php
require 'memory.php';
require 'header.inc';
check_auth($_SERVER['PHP_SELF']); // checks for required access
if ($POST_action == "Register Account!") {
$register_user = $POST_user; //obtains data
$register_password = $POST_pass;
$register_gender = $POST_gender;
$register_code = $POST_code;
$register_email = $POST_email;
$register_level = $POST_level;
// checks lengths of username and password
if (strlen($register_user) < 4 or strlen($register_user) > 24) {
display_error("Account Name must be between 4 and 24 letters.");
}
elseif (strlen($register_password) < 4 or strlen($register_password) > 24) {
display_error("Password has to be between 4 and 24 letters.");
}
elseif (!is_numeric($register_level) && $CONFIG_server_type != 0) {
display_error("Level must be numeric");
}
elseif (strlen($register_email) < 6 or strlen($register_email) > 60) {
display_error("Your email must be between 6 and 60 letters.");
}
elseif ($CONFIG_server_type != 0) {
//check level of GM
if ($register_level > get_gmlevel($STORED_id)) {
display_error("GM level cannot exceed your own");
}
}
else {
$query = sprintf(CHECK_DUPE_ACCOUNT, $register_user); // searches if account already exists
$result = execute_query($query, "register.php");
if ($result->RowCount() > 0) {
redir("add_account.php", "Account Already Exists, please choose another one.");
}
else{
add_account($register_user, $register_password, $register_gender, $register_email, $register_level);
add_admin_entry("Registered $register_user");
redir("add_account.php", "Account $register_user Added!");
}
}
}
else {
EchoHead(50);
echo "
<form action=\"add_account.php\" method=\"POST\">
<tr class=mytitle>
<td colspan=2>GM Add Account</td>
</tr>
<tr class=mycell>
<td>Account Name: </td>
<td><input type=\"text\" class=\"myctl\" name=\"user\"></td>
</tr>
<tr class=mycell>
<td>Password: </td>
<td><input type=\"password\" class=\"myctl\" name=\"pass\"></td>
</tr>";
if ($CONFIG_server_type != 0) {
echo " ;<tr class=mycell>
<td>GM Level: </td>
<td><input type=\"text\" class=\"myctl\" name=\"level\"></td>
</tr>
";}
echo "<tr class=mycell>
<td>Gender: </td>
<td>
<select name=\"gender\" class=\"myctl\">
<option value=M>Male
<option value=F>Female
</select>
</td>
</tr>
<tr class=mycell>
<td>Email: </td>
<td><input type=\"text\" class=\"myctl\" name=\"email\"></td>
</tr>
<tr class=mycell>
<td colspan=2>
<input type=\"submit\" class=\"myctl\" name=\"action\" value=\"Register Account!\">
</td>
</tr>
</form>
</table>
";
}
require 'footer.inc';
function display_error($error_message) {
global $STORED_skin, $start_time, $STORED_level, $queries, $logged_in;
require 'config.php';
require 'extract.inc';
redir("add_account.php", $error_message);
require 'footer.inc';
exit();
}
?>