'1', 'FROM' => 'users AS u', 'WHERE' => 'u.registration_ip=\''.get_remote_address().'\' AND u.registered>'.(time() - 3600) ); ($hook = get_hook('rg_qr_check_register_flood')) ? eval($hook) : null; $result = $pun_db->query_build($query) or error(__FILE__, __LINE__); if ($pun_db->num_rows($result)) $errors[] = $lang_profile['Registration flood']; // Did everything go according to plan so far? if (empty($errors)) { $username = trim($_POST['req_username']); $email1 = strtolower(trim($_POST['req_email1'])); if ($pun_config['o_regs_verify'] == '1') { $email2 = strtolower(trim($_POST['req_email2'])); $password1 = random_key(8, true); $password2 = $password1; } else { $password1 = trim($_POST['req_password1']); $password2 = trim($_POST['req_password2']); } // Validate the username $errors = array_merge($errors, validate_username($username)); // ... and the password if (pun_strlen($password1) < 4) $errors[] = $lang_profile['Pass too short']; else if ($password1 != $password2) $errors[] = $lang_profile['Pass not match']; // ... and the e-mail address require PUN_ROOT.'include/email.php'; if (!is_valid_email($email1)) $errors[] = $lang_common['Invalid e-mail']; else if ($pun_config['o_regs_verify'] == '1' && $email1 != $email2) $errors[] = $lang_profile['E-mail not match']; // Check if it's a banned e-mail address $banned_email = is_banned_email($email1); if ($banned_email && $pun_config['p_allow_banned_email'] == '0') $errors[] = $lang_profile['Banned e-mail']; // Check if someone else already has registered with that e-mail address $dupe_list = array(); $query = array( 'SELECT' => 'u.username', 'FROM' => 'users AS u', 'WHERE' => 'u.email=\''.$email1.'\'' ); ($hook = get_hook('rg_qr_check_email_dupe')) ? eval($hook) : null; $result = $pun_db->query_build($query) or error(__FILE__, __LINE__); if ($pun_db->num_rows($result) && empty($errors)) { if ($pun_config['p_allow_dupe_email'] == '0') $errors[] = $lang_profile['Dupe e-mail']; while ($cur_dupe = $pun_db->fetch_assoc($result)) $dupe_list[] = $cur_dupe['username']; } // Did everything go according to plan so far? if (empty($errors)) { // Make sure we got a valid language string if (isset($_POST['language'])) { $language = preg_replace('#[\.\\\/]#', '', $_POST['language']); if (!file_exists(PUN_ROOT.'lang/'.$language.'/common.php')) message($lang_common['Bad request']); } else $language = $pun_config['o_default_lang']; $save_pass = (!isset($_POST['save_pass']) || $_POST['save_pass'] != '1') ? 0 : 1; $email_setting = intval($_POST['email_setting']); if ($email_setting < 0 || $email_setting > 2) $email_setting = 1; $initial_group_id = ($pun_config['o_regs_verify'] == '0') ? $pun_config['o_default_user_group'] : PUN_UNVERIFIED; $salt = random_key(12); $password_hash = sha1($salt.sha1($password1)); // Insert the new user into the database. We do this now to get the last inserted id for later use. $user_info = array( 'username' => $username, 'group_id' => $initial_group_id, 'salt' => $salt, 'password' => $password1, 'password_hash' => $password_hash, 'email' => $email1, 'email_setting' => $email_setting, 'save_pass' => $save_pass, 'timezone' => $_POST['timezone'], 'dst' => isset($_POST['dst']) ? '1' : '0', 'language' => $language, 'style' => $pun_config['o_default_style'], 'registered' => time(), 'registration_ip' => get_remote_address(), 'activate_key' => ($pun_config['o_regs_verify'] == '1') ? '\''.random_key(8, true).'\'' : 'NULL', 'require_verification' => ($pun_config['o_regs_verify'] == '1'), 'notify_admins' => ($pun_config['o_regs_report'] == '1') ); ($hook = get_hook('rg_register_pre_add_user')) ? eval($hook) : null; add_user($user_info, $new_uid); // If we previously found out that the e-mail was banned if ($banned_email && $pun_config['o_mailing_list'] != '') { ($hook = get_hook('rg_register_banned_email')) ? eval($hook) : null; $mail_subject = 'Alert - Banned e-mail detected'; $mail_message = 'User \''.$username.'\' registered with banned e-mail address: '.$email1."\n\n".'User profile: '.pun_link($pun_url['user'], $new_uid)."\n\n".'-- '."\n".'Forum Mailer'."\n".'(Do not reply to this message)'; pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message); } // If we previously found out that the e-mail was a dupe if (!empty($dupe_list) && $pun_config['o_mailing_list'] != '') { ($hook = get_hook('rg_register_dupe_email')) ? eval($hook) : null; $mail_subject = 'Alert - Duplicate e-mail detected'; $mail_message = 'User \''.$username.'\' registered with an e-mail address that also belongs to: '.implode(', ', $dupe_list)."\n\n".'User profile: '.pun_link($pun_url['user'], $new_uid)."\n\n".'-- '."\n".'Forum Mailer'."\n".'(Do not reply to this message)'; pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message); } ($hook = get_hook('rg_register_pre_login_redirect')) ? eval($hook) : null; // Must the user verify the registration or do we log him/her in right now? if ($pun_config['o_regs_verify'] == '1') message(sprintf($lang_profile['Reg e-mail'], ''.$pun_config['o_admin_email'].'')); pun_setcookie($cookie_name, base64_encode($new_uid.'|'.$password_hash), ($save_pass != '0') ? time() + 31536000 : 0); redirect(pun_link($pun_url['index']), $lang_profile['Reg complete']); } } } // Setup form $pun_page['set_count'] = $pun_page['fld_count'] = 0; $pun_page['form_action'] = $base_url.'/register.php?action=register'; // Setup form information $pun_page['frm_info'][] = '

'.$lang_profile['Register intro'].'

'; if ($pun_config['o_regs_verify'] != '0') $pun_page['frm_info'][] = '

'.$lang_profile['E-mail info'].'

'; // Setup breadcrumbs $pun_page['crumbs'] = array( array($pun_config['o_board_title'], pun_link($pun_url['index'])), $lang_common['Register'] ); ($hook = get_hook('rg_register_pre_header_load')) ? eval($hook) : null; define('PUN_PAGE', 'register'); require PUN_ROOT.'header.php'; ?>

'.$cur_error.''; ($hook = get_hook('rg_pre_register_errors')) ? eval($hook) : null; ?>

'.$lang_common['Required'].'') ?>

read()) !== false) { if ($entry != '.' && $entry != '..' && is_dir(PUN_ROOT.'lang/'.$entry) && file_exists(PUN_ROOT.'lang/'.$entry.'/common.php')) $languages[] = $entry; } $d->close(); // Only display the language selection box if there's more than one language available if (count($languages) > 1) { natcasesort($languages); ?>