1 | <?php |
---|
2 | require_once('class.killboard.php'); |
---|
3 | require_once('class.page.php'); |
---|
4 | |
---|
5 | $killboard = new Killboard(KB_SITE); |
---|
6 | $page = new Page('User - Registration'); |
---|
7 | |
---|
8 | if (config::get('user_regdisabled')) |
---|
9 | { |
---|
10 | $page->error('Registration has been disabled.'); |
---|
11 | return; |
---|
12 | } |
---|
13 | |
---|
14 | if (!config::get('user_noigb') && !IS_IGB) |
---|
15 | { |
---|
16 | $page->error('You have to use the IGB to register.'); |
---|
17 | return; |
---|
18 | } |
---|
19 | |
---|
20 | if (isset($_POST['submit'])) |
---|
21 | { |
---|
22 | $error = false; |
---|
23 | if (config::get('user_regpass')) |
---|
24 | { |
---|
25 | if ($_POST['regpass'] != config::get('user_regpass')) |
---|
26 | { |
---|
27 | $smarty->assign('error', 'Registration password does not match.'); |
---|
28 | $error = true; |
---|
29 | } |
---|
30 | } |
---|
31 | |
---|
32 | if (!$_POST['usrlogin']) |
---|
33 | { |
---|
34 | $smarty->assign('error', 'You missed to specify a login.'); |
---|
35 | $error = true; |
---|
36 | } |
---|
37 | |
---|
38 | if (!$_POST['usrpass']) |
---|
39 | { |
---|
40 | $smarty->assign('error', 'You missed to specify a password.'); |
---|
41 | $error = true; |
---|
42 | } |
---|
43 | |
---|
44 | if (strlen($_POST['usrpass']) < 3) |
---|
45 | { |
---|
46 | $smarty->assign('error', 'Your password needs to have at least 4 chars.'); |
---|
47 | $error = true; |
---|
48 | } |
---|
49 | |
---|
50 | if (!$error) |
---|
51 | { |
---|
52 | $pilot = null; |
---|
53 | $id = null; |
---|
54 | if (IS_IGB) |
---|
55 | { |
---|
56 | $pilot = $_SERVER["HTTP_EVE_CHARNAME"]; |
---|
57 | $_POST['usrlogin'] = $pilot; |
---|
58 | $id = $_SERVER["HTTP_EVE_CHARID"]; |
---|
59 | } |
---|
60 | user::register(slashfix($_POST['usrlogin']), slashfix($_POST['usrpass']), $pilot, $id); |
---|
61 | $page->setContent('Account registered.'); |
---|
62 | $page->generate(); |
---|
63 | return; |
---|
64 | } |
---|
65 | } |
---|
66 | |
---|
67 | if (IS_IGB) |
---|
68 | { |
---|
69 | $smarty->assign('user_name', $_SERVER["HTTP_EVE_CHARNAME"]); |
---|
70 | } |
---|
71 | |
---|
72 | $page->setContent($smarty->fetch(get_tpl('user_register'))); |
---|
73 | $page->generate(); |
---|
74 | ?> |
---|