Revision 275
Added by stefan almost 19 years ago
signup2.php | ||
---|---|---|
27 | 27 |
header('Location: ../pages/index.php'); |
28 | 28 |
} |
29 | 29 |
|
30 |
require_once(WB_PATH.'/framework/class.admin.php');
|
|
31 |
$admin = new admin('Start', 'start', false, false);
|
|
30 |
require_once(WB_PATH.'/framework/class.wb.php');
|
|
31 |
$wb = new wb('Start', 'start', false, false);
|
|
32 | 32 |
|
33 | 33 |
// Create new database object |
34 | 34 |
$database = new database(); |
... | ... | |
36 | 36 |
// Get details entered |
37 | 37 |
$group_id = FRONTEND_SIGNUP; |
38 | 38 |
$active = 1; |
39 |
$username = strtolower($admin->get_post('username'));
|
|
40 |
$display_name = $admin->get_post('display_name');
|
|
41 |
$email = $admin->get_post('email');
|
|
39 |
$username = strtolower($wb->get_post('username'));
|
|
40 |
$display_name = $wb->get_post('display_name');
|
|
41 |
$email = $wb->get_post('email');
|
|
42 | 42 |
|
43 | 43 |
// Create a javascript back link |
44 | 44 |
$js_back = "javascript: history.go(-1);"; |
45 | 45 |
|
46 | 46 |
// Check values |
47 | 47 |
if($group_id == "") { |
48 |
$admin->print_error($MESSAGE['USERS']['NO_GROUP'], $js_back);
|
|
48 |
$wb->print_error($MESSAGE['USERS']['NO_GROUP'], $js_back, false);
|
|
49 | 49 |
} |
50 | 50 |
if(strlen($username) < 3) { |
51 |
$admin->print_error($MESSAGE['USERS']['USERNAME_TOO_SHORT'], $js_back);
|
|
51 |
$wb->print_error($MESSAGE['USERS']['USERNAME_TOO_SHORT'], $js_back, false);
|
|
52 | 52 |
} |
53 | 53 |
if($email != "") { |
54 |
if($admin->validate_email($email) == false) {
|
|
55 |
$admin->print_error($MESSAGE['USERS']['INVALID_EMAIL'], $js_back);
|
|
54 |
if($wb->validate_email($email) == false) {
|
|
55 |
$wb->print_error($MESSAGE['USERS']['INVALID_EMAIL'], $js_back, false);
|
|
56 | 56 |
} |
57 | 57 |
} else { |
58 |
$admin->print_error($MESSAGE['SIGNUP']['NO_EMAIL'], $js_back);
|
|
58 |
$wb->print_error($MESSAGE['SIGNUP']['NO_EMAIL'], $js_back, false);
|
|
59 | 59 |
} |
60 | 60 |
// Captcha |
61 | 61 |
if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg') AND CAPTCHA_VERIFICATION) { /* Make's sure GD library is installed */ |
62 | 62 |
if(isset($_POST['captcha']) AND $_POST['captcha'] != ''){ |
63 | 63 |
// Check for a mismatch |
64 | 64 |
if(!isset($_POST['captcha']) OR !isset($_SESSION['captcha']) OR $_POST['captcha'] != $_SESSION['captcha']) { |
65 |
$admin->print_error($MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA'], $js_back);
|
|
65 |
$wb->print_error($MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA'], $js_back, false);
|
|
66 | 66 |
} |
67 | 67 |
} else { |
68 |
$admin->print_error($MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA'], $js_back);
|
|
68 |
$wb->print_error($MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA'], $js_back, false);
|
|
69 | 69 |
} |
70 | 70 |
} |
71 | 71 |
if(isset($_SESSION['catpcha'])) { unset($_SESSION['captcha']); } |
... | ... | |
86 | 86 |
// Check if username already exists |
87 | 87 |
$results = $database->query("SELECT user_id FROM ".TABLE_PREFIX."users WHERE username = '$username'"); |
88 | 88 |
if($results->numRows() > 0) { |
89 |
$admin->print_error($MESSAGE['USERS']['USERNAME_TAKEN'], $js_back);
|
|
89 |
$wb->print_error($MESSAGE['USERS']['USERNAME_TAKEN'], $js_back, false);
|
|
90 | 90 |
} |
91 | 91 |
|
92 | 92 |
// Check if the email already exists |
93 | 93 |
$results = $database->query("SELECT user_id FROM ".TABLE_PREFIX."users WHERE email = '".$wb->add_slashes($_POST['email'])."'"); |
94 | 94 |
if($results->numRows() > 0) { |
95 | 95 |
if(isset($MESSAGE['USERS']['EMAIL_TAKEN'])) { |
96 |
$admin->print_error($MESSAGE['USERS']['EMAIL_TAKEN'], $js_back);
|
|
96 |
$wb->print_error($MESSAGE['USERS']['EMAIL_TAKEN'], $js_back, false);
|
|
97 | 97 |
} else { |
98 |
$admin->print_error($MESSAGE['USERS']['INVALID_EMAIL'], $js_back);
|
|
98 |
$wb->print_error($MESSAGE['USERS']['INVALID_EMAIL'], $js_back, false);
|
|
99 | 99 |
} |
100 | 100 |
} |
101 | 101 |
|
... | ... | |
126 | 126 |
|
127 | 127 |
// Try sending the email |
128 | 128 |
if(mail($mail_to, $mail_subject, $mail_message, 'From: '.SERVER_EMAIL)) { |
129 |
$admin->print_success($MESSAGE['FORGOT_PASS']['PASSWORD_RESET'], WB_URL.'/account/login'.PAGE_EXTENSION);
|
|
129 |
$wb->print_success($MESSAGE['FORGOT_PASS']['PASSWORD_RESET'], WB_URL.'/account/login'.PAGE_EXTENSION);
|
|
130 | 130 |
$display_form = false; |
131 | 131 |
} else { |
132 |
$admin->print_error($MESSAGE['FORGOT_PASS']['CANNOT_EMAIL'], $js_back);
|
|
132 |
$wb->print_error($MESSAGE['FORGOT_PASS']['CANNOT_EMAIL'], $js_back, false);
|
|
133 | 133 |
} |
134 | 134 |
} |
135 | 135 |
|
Also available in: Unified diff
Replace 'admin' by 'wb' in all account pages. Moved print_success and print_error code to class.wb.php. Added correct parameters to these functions in account pages.