userinfo['userid']) { $message->error(lang::p('error_already_registered')); } if (!$bugsys->options['allownewreg']) { $message->error(lang::p('error_no_new_registrations')); } foreach ($bugsys->datastore['language'] AS $value => $temp) { $label = $temp['title']; eval('$opts .= "' . $template->fetch('selectoption') . '";'); } eval('$template->flush("' . $template->fetch('register') . '");'); } // ################################################################### if ($_POST['do'] == 'insert') { if ($bugsys->userinfo['userid']) { $message->error(lang::p('error_already_registered')); } if (!$bugsys->options['allownewreg']) { $message->error(lang::p('error_no_new_registrations')); } if ($bugsys->in['email'] != $bugsys->in['confirmemail']) { $message->phrase[] = 'register_emails_no_match'; } if (!$bugsys->in['email']) { $message->phrase[] = 'register_blank_email'; } if ($bugsys->in['password'] != $bugsys->in['confirmpassword']) { $message->phrase[] = 'register_passwords_no_match'; } if (!$bugsys->in['password']) { $message->phrase[] = 'register_blank_password'; } if (!$funct->is_valid_email($bugsys->in['email'])) { $message->phrase[] = 'register_invalid_email'; } if (is_array($db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE email = '" . $bugsys->in['email'] . "'"))) { $message->phrase[] = 'register_email_in_use'; } if ($message->phrase) { $message->error_list_process(); $message->error(); } $salt = $funct->rand(15); if ($bugsys->options['verifyemail']) { $usergroupid = 3; } else { if ($bugsys->options['moderatenewusers']) { $usergroupid = 4; } else { $usergroupid = 2; } } $db->query(" INSERT INTO " . TABLE_PREFIX . "user (email, displayname, password, salt, authkey, showemail, languageid, usergroupid) VALUES ('" . $bugsys->in['email'] . "', '" . $bugsys->in['displayname'] . "', '" . md5(md5($bugsys->in['password']) . md5($salt)) . "', '$salt', '" . $funct->rand() . "', " . intval($bugsys->in['showemail']) . ", " . intval($bugsys->in['languageid']) . ", $usergroupid )" ); $userid = $db->insert_id(); // Verify email address if ($usergroupid == 3) { $activationid = $funct->rand(25); $db->query("INSERT INTO " . TABLE_PREFIX . "useractivation (userid, activator, dateline, usergroupid) VALUES ($userid, '$activationid', " . TIMENOW . ", 2)"); $mail->to = $bugsys->in['email']; $mail->subject = lang::r('Welcome to ' . $bugsys->options['trackertitle']); $mail->body = lang::r("Hi " . $bugsys->in['displayname'] . " you need to activate your account: http://devbox/bugtraq/register.php?do=activate&userid=" . $userid . "&activator=" . $activationid); $mail->send(); $message->message(lang::p('need_to_activate_account')); } else if ($usergroupid == 4 OR $usergroupid == 2) { if ($bugsys->options['sendwelcomemail']) { $mail->to = $bugsys->in['email']; $mail->subject = lang::r('Welcome to ' . $bugsys->options['trackertitle']); $mail->body = lang::r("Hi " . $bugsys->in['displayname'] . " and welcome to the " . $bugsys->options['trackertitle'] . " bug tracker! Thanks for registering."); $mail->send(); } if ($usergroupid == 4) { $message->message(lang::p('account_pending_approval')); } else { $message->message(lang::r('Registration complete!')); } } } // ################################################################### if ($_REQUEST['do'] == 'activate') { if ($useractivation = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "useractivation WHERE userid = " . intval($bugsys->in['userid']) . " AND activator = '" . $bugsys->in['activator'] . "'")) { $user = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE userid = " . intval($bugsys->in['userid'])); $db->query("UPDATE " . TABLE_PREFIX . "user SET usergroupid = $useractivation[usergroupid] WHERE userid = " . intval($bugsys->in['userid'])); $db->query("DELETE FROM " . TABLE_PREFIX . "useractivation WHERE userid = " . intval($bugsys->in['userid'])); if ($bugsys->options['sendwelcomemail']) { $mail->to = $user['email']; $mail->subject = lang::r('Welcome to ' . $bugsys->options['trackertitle']); $mail->body = lang::r("Hi " . $user['displayname'] . " and welcome to the " . $bugsys->options['trackertitle'] . " bug tracker! Thanks for registering."); $mail->send(); } $message->message(lang::p('account_activated')); } else { $message->error(lang::p('error_invalid_registration_key')); } } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>