/
register.php
58 lines (46 loc) · 1.24 KB
/
register.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
<?
// Include common functions and declarations
require_once "include/common.php";
// Check if registration is allowed in this system
if ($settings->allowUserRegistration) {
// Get user identifier
$id = getGetValue("userId");
// Create user object
$user = new User($id);
// Add navigation link
$site->addNavigationLink(scriptUrl."/".fileRegister, $lRegister["Header"]);
// Check if user should be registered
if (!empty($_GET["save"])) {
// Register user profile
$errors = $user->saveUser();
// Check if errors occured during registration
if (!$errors->hasErrors()) {
// Print header
$site->printHeader(false);
// Print success message
$site->printSectionHeader($lRegister["Success"]);
printf("<p>".$lRegister["SuccessText"]."</p>", $user->username);
// Print common footer
$site->printFooter();
exit();
}
}
// Print header
$site->printHeader();
// Print registration text
echo "<p>".$lRegister["HeaderText"]."</p>";
// Check for errors
if ($errors->hasErrors()) {
$errors->printErrorMessages();
echo "<br />";
}
// Include user form
$register = true;
include scriptPath."/".folderUsers."/include/form/userForm.php";
// Print user footer
$site->printFooter();
}
else {
redirect(scriptUrl);
}
?>