userinfo['userid']) { $message->error($lang->string('Sorry, you are already registered.')); } if (!$bugsys->options['allownewreg']) { $message->error($lang->string('Sorry, we don\'t allow 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->string('Sorry, you are already registered.')); } if (!$bugsys->options['allownewreg']) { $message->error($lang->string('Sorry, we don\'t allow new registrations.')); } if ($bugsys->in['email'] != $bugsys->in['confirmemail']) { $message->phrase[] = $lang->string('The emails you entered do not match.'); } if (!$bugsys->in['email']) { $message->phrase[] = $lang->string('The email you specified was blank.'); } if ($bugsys->in['password'] != $bugsys->in['confirmpassword']) { $message->phrase[] = $lang->string('The passwords you entered did not match.'); } if (!$bugsys->in['password']) { $message->phrase[] = $lang->string('The password you specified was blank.'); } if (!$funct->is_valid_email($bugsys->in['email'])) { $message->phrase[] = $lang->string('The specified email is invalid.'); } if (is_array($db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE email = '" . $bugsys->in['email'] . "'"))) { $message->phrase[] = $lang->string('The specified email is already in use.'); } if (is_array($db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE displayname = '" . $bugsys->in['displayname'] . "'"))) { $message->phrase[] = $lang->string('That display name is already in use by another user'); } 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, showcolours, languageid, usergroupid) VALUES ('" . $bugsys->in['email'] . "', '" . $bugsys->in['displayname'] . "', '" . md5(md5($bugsys->in['password']) . md5($salt)) . "', '$salt', '" . $funct->rand() . "', " . intval($bugsys->in['showemail']) . ", 1, " . 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 = sprintf($lang->string('Welcome to %1$s'), $bugsys->options['trackertitle']); $mail->body = sprintf($lang->string('Hi %1$s, Welcome to the %2$s tracker. Before you can begin posting bug reports, you\'ll need to activae your account. To do this, please click this link: %3$s/register.php?do=activate&userid=%4$s&activator=%5$s'), $bugsys->in['displayname'], $bugsys->options['trackertitle'], $bugsys->options['trackerurl'], $userid, $activationid ); $mail->send(); $message->message($lang->string('You now need to activate your account via email.')); } else if ($usergroupid == 4 OR $usergroupid == 2) { if ($bugsys->options['sendwelcomemail']) { $mail->to = $bugsys->in['email']; $mail->subject = sprintf($lang->string('Welcome to %1$s'), $bugsys->options['trackertitle']); $mail->body = sprintf($lang->string('Hi %1$s, Thank you for taking the time to register at %2$s. We look forward to your contributations to making our products better. If you have any questions, please don\'t hesitate to contact the webmaster.'), $bugsys->in['displayname'], $bugsys->options['trackertitle'] ); $mail->send(); } if ($usergroupid == 4) { $message->message($lang->string('Your account is pending approval.')); } else { $message->message($lang->string('Thank you for registering. You may now use your account.')); } } } // ################################################################### 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 = sprintf($lang->string('Welcome to %1$s'), $bugsys->options['trackertitle']); $mail->body = sprintf($lang->string('Hi %1$s, Thank you for taking the time to register at %2$s. We look forward to your contributations to making our products better. If you have any questions, please don\'t hesitate to contact the webmaster.'), $user['displayname'], $bugsys->options['trackertitle'] ); $mail->send(); } $message->message($lang->string('Your account is now activated and you can now login.')); } else { $message->error($lang->string('Sorry, we could not match your registration string. Please make sure you entered the correct URL.')); } } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>