2 /*=====================================================================*\
3 || ################################################################### ||
4 || # BugStrike [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
7 || # This file may not be reproduced in any way without permission. # ||
8 || # --------------------------------------------------------------- # ||
9 || # User License Agreement at http://www.iris-studios.com/license/ # ||
10 || ################################################################### ||
11 \*=====================================================================*/
13 $fetchtemplates = array(
17 define('SVN', '$Id$');
19 require_once('./global.php');
21 // ###################################################################
23 if ($bugsys->userinfo
['userid'])
25 $message->error('Sorry, you are already registered!');
28 if (!$bugsys->options
['allownewreg'])
30 $message->error('Sorry, we don\'t allow new registrations!');
33 // ###################################################################
35 if (empty($_REQUEST['do']))
37 foreach ($bugsys->datastore
['language'] AS $value => $temp)
39 $label = $temp['title'];
40 eval('$opts .= "' . $template->fetch('selectoption') . '";');
43 eval('$template->flush("' . $template->fetch('register') . '");');
46 // ###################################################################
48 if ($_POST['do'] == 'insert')
50 if ($bugsys->in
['email'] != $bugsys->in
['confirmemail'])
52 $error->phrase
[] = 'The emails you entered do not match.';
55 if (!$bugsys->in
['email'])
57 $error->phrase
[] = 'The password you specified was blank.';
60 if ($bugsys->in
['password'] != $bugsys->in
['confirmpassword'])
62 $error->phrase
[] = 'The passwords you entered did not match.';
65 if (!$bugsys->in
['password'])
67 $error->phrase
[] = 'The password you specified was blank.';
70 if (!$funct->is_valid_email($bugsys->in
['email']))
72 $error->phrase
[] = 'The specified email is invalid.';
75 if (is_array($db->query_first("SELECT * FROM " . TABLE_PREFIX
. "user WHERE email = '" . $bugsys->in
['email'] . "'")))
77 $error->phrase
[] = 'The specified email is already in use.';
80 $message->error_list_process();
83 $salt = $funct->rand(15);
85 if ($bugsys->options
['verifyemail'])
91 if ($bugsys->options
['moderatenewusers'])
102 INSERT INTO " . TABLE_PREFIX
. "user
103 (email, displayname, password, salt, authkey, showemail, languageid, usergroupid)
105 ('" . $bugsys->in
['email'] . "',
106 '" . $bugsys->in
['displayname'] . "',
107 '" . md5(md5($bugsys->in
['password']) . md5($salt)) . "',
109 '" . $funct->rand() . "',
110 " . intval($bugsys->in
['showemail']) . ",
111 " . intval($bugsys->in
['languageid']) . ",
116 $userid = $db->insert_id();
118 // Verify email address
119 if ($usergroupid == 3)
121 $activationid = $funct->rand(25);
123 $db->query("INSERT INTO " . TABLE_PREFIX
. "useractivation (userid, activator, dateline, usergroupid) VALUES ($userid, '$activationid', " . NOW
. ", 2)");
125 $mail->to
= $bugsys->in
['email'];
126 $mail->subject
= 'Welcome to ' . $bugsys->options
['trackertitle'];
127 $mail->body
= "Hi " . $bugsys->in
['displayname'] . " you need to activate your account: http://devbox/bugtraq/register.php?do=activate&userid=" . $userid . "&activator=" . $activationid;
130 $message->message('You now need to activate your account via email.');
132 else if ($usergroupid == 4 OR $usergroupid == 2)
134 if ($bugsys->options
['sendwelcomemail'])
136 $mail->to
= $bugsys->in
['email'];
137 $mail->subject
= 'Welcome to ' . $bugsys->options
['trackertitle'];
138 $mail->body
= "Hi " . $bugsys->in
['displayname'] . " and welcome to the " . $bugsys->options
['trackertitle'] . " bug tracker! Thanks for registering.";
142 if ($usergroupid == 4)
144 $message->message('Your account is pending approval.');
148 $message->message('Registration complete!');
153 // ###################################################################
155 if ($_REQUEST['do'] == 'activate')
157 if ($useractivation = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "useractivation WHERE userid = " . intval($bugsys->in
['userid']) . " AND activator = '" . $bugsys->in
['activator'] . "'"))
159 $db->query("UPDATE " . TABLE_PREFIX
. "user SET usergroupid = $useractivation[usergroupid] WHERE userid = " . intval($bugsys->in
['userid']));
160 $db->query("DELETE FROM " . TABLE_PREFIX
. "useractivation WHERE userid = " . intval($bugsys->in
['userid']));
161 $message->message('your account is now activated and you can now login');
165 $message->error('we could not match your registration string. please make sure you entered the correct url');
169 /*=====================================================================*\
170 || ###################################################################
173 || ###################################################################
174 \*=====================================================================*/