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 require_once('./global.php');
19 // ###################################################################
21 if ($bugsys->userinfo
['userid'])
23 $message->error('Sorry, you are already registered!');
26 if (!$bugsys->options
['allownewreg'])
28 $message->error('Sorry, we don\'t allow new registrations!');
31 // ###################################################################
33 if (empty($_REQUEST['do']))
35 foreach ($bugsys->datastore
['language'] AS $value => $temp)
37 $label = $temp['title'];
38 eval('$opts .= "' . $template->fetch('selectoption') . '";');
41 eval('$template->flush("' . $template->fetch('register') . '");');
44 // ###################################################################
46 if ($_POST['do'] == 'insert')
48 if ($bugsys->in
['email'] != $bugsys->in
['confirmemail'])
50 $error->phrase
[] = 'The emails you entered do not match.';
53 if (!$bugsys->in
['email'])
55 $error->phrase
[] = 'The password you specified was blank.';
58 if ($bugsys->in
['password'] != $bugsys->in
['confirmpassword'])
60 $error->phrase
[] = 'The passwords you entered did not match.';
63 if (!$bugsys->in
['password'])
65 $error->phrase
[] = 'The password you specified was blank.';
68 if (!$funct->is_valid_email($bugsys->in
['email']))
70 $error->phrase
[] = 'The specified email is invalid.';
73 if (is_array($db->query_first("SELECT * FROM " . TABLE_PREFIX
. "user WHERE email = '" . $bugsys->in
['email'] . "'")))
75 $error->phrase
[] = 'The specified email is already in use.';
78 $message->error_list_process();
81 $salt = $funct->rand(15);
83 if ($bugsys->options
['verifyemail'])
89 if ($bugsys->options
['moderatenewusers'])
100 INSERT INTO " . TABLE_PREFIX
. "user
101 (email, displayname, password, salt, authkey, showemail, languageid, usergroupid)
103 ('" . $bugsys->in
['email'] . "',
104 '" . $bugsys->in
['displayname'] . "',
105 '" . md5(md5($bugsys->in
['password']) . md5($salt)) . "',
107 '" . $funct->rand() . "',
108 " . intval($bugsys->in
['showemail']) . ",
109 " . intval($bugsys->in
['languageid']) . ",
114 $userid = $db->insert_id();
116 // Verify email address
117 if ($usergroupid == 3)
119 $activationid = $funct->rand(25);
121 $db->query("INSERT INTO " . TABLE_PREFIX
. "useractivation (userid, activator, dateline, usergroupid) VALUES ($userid, '$activationid', " . NOW
. ", 2)");
123 $mail->to
= $bugsys->in
['email'];
124 $mail->subject
= 'Welcome to ' . $bugsys->options
['trackertitle'];
125 $mail->body
= "Hi " . $bugsys->in
['displayname'] . " you need to activate your account: http://devbox/bugtraq/register.php?do=activate&userid=" . $userid . "&activator=" . $activationid;
128 $message->message('You now need to activate your account via email.');
130 else if ($usergroupid == 4 OR $usergroupid == 2)
132 if ($bugsys->options
['sendwelcomemail'])
134 $mail->to
= $bugsys->in
['email'];
135 $mail->subject
= 'Welcome to ' . $bugsys->options
['trackertitle'];
136 $mail->body
= "Hi " . $bugsys->in
['displayname'] . " and welcome to the " . $bugsys->options
['trackertitle'] . " bug tracker! Thanks for registering.";
140 if ($usergroupid == 4)
142 $message->message('Your account is pending approval.');
146 $message->message('Registration complete!');
151 // ###################################################################
153 if ($_REQUEST['do'] == 'activate')
155 if ($useractivation = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "useractivation WHERE userid = " . intval($bugsys->in
['userid']) . " AND activator = '" . $bugsys->in
['activator'] . "'"))
157 $db->query("UPDATE " . TABLE_PREFIX
. "user SET usergroupid = $useractivation[usergroupid] WHERE userid = " . intval($bugsys->in
['userid']));
158 $db->query("DELETE FROM " . TABLE_PREFIX
. "useractivation WHERE userid = " . intval($bugsys->in
['userid']));
159 $message->message('your account is now activated and you can now login');
163 $message->error('we could not match your registration string. please make sure you entered the correct url');
167 /*=====================================================================*\
168 || ###################################################################
171 || ###################################################################
172 \*=====================================================================*/