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 $focus['user'] = 'focus';
21 require_once('./global.php');
23 // ###################################################################
25 if ($bugsys->userinfo
['userid'])
27 $message->error('Sorry, you are already registered!');
30 if (!$bugsys->options
['allownewreg'])
32 $message->error('Sorry, we don\'t allow new registrations!');
35 // ###################################################################
37 if (empty($_REQUEST['do']))
39 foreach ($bugsys->datastore
['language'] AS $value => $temp)
41 $label = $temp['title'];
42 eval('$opts .= "' . $template->fetch('selectoption') . '";');
45 eval('$template->flush("' . $template->fetch('register') . '");');
48 // ###################################################################
50 if ($_POST['do'] == 'insert')
52 if ($bugsys->in
['email'] != $bugsys->in
['confirmemail'])
54 $error->phrase
[] = 'The emails you entered do not match.';
57 if (!$bugsys->in
['email'])
59 $error->phrase
[] = 'The password you specified was blank.';
62 if ($bugsys->in
['password'] != $bugsys->in
['confirmpassword'])
64 $error->phrase
[] = 'The passwords you entered did not match.';
67 if (!$bugsys->in
['password'])
69 $error->phrase
[] = 'The password you specified was blank.';
72 if (!$funct->is_valid_email($bugsys->in
['email']))
74 $error->phrase
[] = 'The specified email is invalid.';
77 if (is_array($db->query_first("SELECT * FROM " . TABLE_PREFIX
. "user WHERE email = '" . $bugsys->in
['email'] . "'")))
79 $error->phrase
[] = 'The specified email is already in use.';
82 $message->error_list_process();
85 $salt = $funct->rand(15);
87 if ($bugsys->options
['verifyemail'])
93 if ($bugsys->options
['moderatenewusers'])
104 INSERT INTO " . TABLE_PREFIX
. "user
105 (email, displayname, password, salt, authkey, showemail, languageid, usergroupid)
107 ('" . $bugsys->in
['email'] . "',
108 '" . $bugsys->in
['displayname'] . "',
109 '" . md5(md5($bugsys->in
['password']) . md5($salt)) . "',
111 '" . $funct->rand() . "',
112 " . intval($bugsys->in
['showemail']) . ",
113 " . intval($bugsys->in
['languageid']) . ",
118 $userid = $db->insert_id();
120 // Verify email address
121 if ($usergroupid == 3)
123 $activationid = $funct->rand(25);
125 $db->query("INSERT INTO " . TABLE_PREFIX
. "useractivation (userid, activator, dateline, usergroupid) VALUES ($userid, '$activationid', " . NOW
. ", 2)");
127 $mail->to
= $bugsys->in
['email'];
128 $mail->subject
= 'Welcome to ' . $bugsys->options
['trackertitle'];
129 $mail->body
= "Hi " . $bugsys->in
['displayname'] . " you need to activate your account: http://devbox/bugtraq/register.php?do=activate&userid=" . $userid . "&activator=" . $activationid;
132 $message->message('You now need to activate your account via email.');
134 else if ($usergroupid == 4 OR $usergroupid == 2)
136 if ($bugsys->options
['sendwelcomemail'])
138 $mail->to
= $bugsys->in
['email'];
139 $mail->subject
= 'Welcome to ' . $bugsys->options
['trackertitle'];
140 $mail->body
= "Hi " . $bugsys->in
['displayname'] . " and welcome to the " . $bugsys->options
['trackertitle'] . " bug tracker! Thanks for registering.";
144 if ($usergroupid == 4)
146 $message->message('Your account is pending approval.');
150 $message->message('Registration complete!');
155 // ###################################################################
157 if ($_REQUEST['do'] == 'activate')
159 if ($useractivation = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "useractivation WHERE userid = " . intval($bugsys->in
['userid']) . " AND activator = '" . $bugsys->in
['activator'] . "'"))
161 $db->query("UPDATE " . TABLE_PREFIX
. "user SET usergroupid = $useractivation[usergroupid] WHERE userid = " . intval($bugsys->in
['userid']));
162 $db->query("DELETE FROM " . TABLE_PREFIX
. "useractivation WHERE userid = " . intval($bugsys->in
['userid']));
163 $message->message('your account is now activated and you can now login');
167 $message->error('we could not match your registration string. please make sure you entered the correct url');
171 /*=====================================================================*\
172 || ###################################################################
175 || ###################################################################
176 \*=====================================================================*/