- // Write catgories
- if ((is_array(postRequestElement('cat'))) && (count(postRequestElement('cat')))) {
- foreach (postRequestElement('cat') as $cat => $joined) {
- if ($joined == 'Y') {
- // Insert category entry
- SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_cats` (userid, cat_id) VALUES (%s, %s)",
- array(bigintval($userid), bigintval($cat)), __FILE__, __LINE__);
- } // END - if
- } // END - foreach
- } // END - if
-
- // Rewrite gender
- $gender = translateGender(postRequestElement('gender'));
-
- // ... rewrite a zero referal id to the main title
- if (postRequestElement('refid') == '0') setRequestPostElement('refid', getConfig('MAIN_TITLE'));
-
- // Is ZIP code set?
- if (isPostRequestElementSet('zip')) {
- // Prepare data array for the email template
- // Start with the gender...
- $content = array(
- 'hash' => $hash,
- 'userid' => $userid,
- 'gender' => $gender,
- 'surname' => SQL_ESCAPE(postRequestElement('surname')),
- 'family' => SQL_ESCAPE(postRequestElement('family')),
- 'email' => SQL_ESCAPE(postRequestElement('email')),
- 'street' => SQL_ESCAPE(postRequestElement('street_nr')),
- 'city' => SQL_ESCAPE(postRequestElement('city')),
- 'zip' => bigintval(postRequestElement('zip')),
- 'country' => $countryData,
- 'refid' => SQL_ESCAPE(postRequestElement('refid')),
- 'pass' => SQL_ESCAPE(postRequestElement('pass1')),
- );
- } else {
- // No ZIP code entered
- $content = array(
- 'hash' => $hash,
- 'userid' => $userid,
- 'gender' => $gender,
- 'surname' => SQL_ESCAPE(postRequestElement('surname')),
- 'family' => SQL_ESCAPE(postRequestElement('family')),
- 'email' => SQL_ESCAPE(postRequestElement('email')),
- 'street' => SQL_ESCAPE(postRequestElement('street_nr')),
- 'city' => SQL_ESCAPE(postRequestElement('city')),
- 'zip' => '',
- 'country' => $countryData,
- 'refid' => SQL_ESCAPE(postRequestElement('refid')),
- 'pass' => SQL_ESCAPE(postRequestElement('pass1')),
- );
- }
-
- // Continue with birthday...
- switch (getLanguage()) {
- case 'de':
- $content['birthday'] = bigintval(postRequestElement('day')) . '.' . bigintval(postRequestElement('month')) . '.' . bigintval(postRequestElement('year'));
- break;
-
- default:
- $content['birthday'] = bigintval(postRequestElement('month')) . '/' . bigintval(postRequestElement('day')) . '/' . bigintval(postRequestElement('year'));
- break;
- } // END - switch
-
- // Display information to the user that he got mail and send it away
- $messageGuest = loadEmailTemplate('register-member', $content, $userid);
-
- // Send mail to user (confirmation link!)
- $email = $content['email'];
- sendEmail($content['email'], getMessage('GUEST_SUBJECT_CONFIRM_LINK'), $messageGuest);
- $content['email'] = $email;
-
- // Send mail to admin
- sendAdminNotification(getMessage('ADMIN_SUBJECT_NEW_ACCOUNT'), 'register-admin', $content, $userid);
-
- // Output success registration
- loadTemplate('admin_settings_saved', false, getMessage('REGISTRATION_DONE'));
-} else {
- if (postRequestElement('agree') == '!') {
- registerOutputFailedMessage('HAVE_TO_AGREE');
- } // END - if
-
- if (postRequestElement('email') == '!') {
- registerOutputFailedMessage('ENTER_EMAIL');
- setRequestPostElement('email', '');
- } elseif (postRequestElement('email') == '?') {
- registerOutputFailedMessage('EMAIL_ALREADY_DB');
- setRequestPostElement('email', '');
- }
-
- if (postRequestElement('surname') == '!') {
- registerOutputFailedMessage('ENTER_SURNAME');
- setRequestPostElement('surname', '');
- } // END - if
-
- if (postRequestElement('family') == '!') {
- registerOutputFailedMessage('ENTER_FAMILY');
- setRequestPostElement('family', '');
- } // END - if
-
- if ((postRequestElement('pass1') == '!') && (postRequestElement('pass2') == '!')) {
- registerOutputFailedMessage('ENTER_BOTH_PASSWORDS');
- } elseif (postRequestElement('pass1') == '!') {
- registerOutputFailedMessage('ENTER_PASS1');
- } elseif (postRequestElement('pass2') == '!') {
- registerOutputFailedMessage('ENTER_PASS2');
- }
-
- if ($shortPass === true) {
- registerOutputFailedMessage('SHORT_PASS', ": ".getConfig('pass_len'));
- } // END - if
-
- if ($ipTimedOut === true) {
- registerOutputFailedMessage('REMOTE_ADDR_TIMEOUT');
- } // END - if
-
- if ((!empty($cats)) && ($cats < getConfig('least_cats'))) {
- registerOutputFailedMessage(sprintf(getMessage('CATS_LEAST'), getConfig('least_cats')));
- } // END - if
-