2 /*=====================================================================*\
3 || ################################################################### ||
4 || # [#]app[#] [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # All parts of this file are ©2003-[#]year[#] Iris Studios, Inc. No # ||
7 || # part of this file may be reproduced in any way: part or whole. # ||
8 || # --------------------------------------------------------------- # ||
9 || # ©2003 - [#]year[#] Iris Studios, Inc. | http://www.iris-studios.com # ||
10 || ################################################################### ||
11 \*=====================================================================*/
13 require_once('./global.php');
15 // ###################################################################
17 if ($bugsys->userinfo
['userid'])
19 echo 'Sorry, you are already registered!';
23 if (!$bugsys->options
['allownewreg'])
25 echo 'Sorry, we don\'t allow new registrations!';
29 // ###################################################################
31 if (empty($_REQUEST['do']))
33 foreach ($bugsys->datastore
['language'] AS $languageid => $language)
35 $opts .= "<option value=\"$languageid\">$language[title]</option>";
39 <form action
="register.php" name
="register" method
="post">
40 <input type
="hidden" name
="do" value
="insert" />
41 Email
: <input type
="text" name
="email" size
="30" /><br
/>
42 Confirm Email
: <input type
="text" name
="confirmemail" size
="30" /><br
/>
43 Display Name
: <input type
="text" name
="displayname" size
="30" /><br
/>
44 Password
: <input type
="password" name
="password" size
="30" /><br
/>
45 Confirm Password
: <input type
="password" name
="confirmpassword" size
="30" /><br
/>
46 Show My Email Publicly
: <input type
="checkbox" value
="1" name
="showemail" /> Yes
<br
/>
47 Language
: <select name
="languageid">$opts</select
><br
/>
48 <input type
="submit" name
="submit" value
="Save" accesskey
="s" /> <input type
="reset" name
="reset" value
="Reset" accesskey
="r" />
53 // ###################################################################
55 if ($_POST['do'] == 'insert')
57 sanitize(array('email' => STR_NOHTML
, 'confirmemail' => STR_NOHTML
, 'displayname' => STR_NOHTML
, 'password' => STR
, 'confirmpassword' => STR
, 'showemail' => INT, 'languageid' => INT));
59 if ($vars['email'] != $vars['confirmemail'])
61 $errors[] = 'The emails you entered do not match.';
66 $errors[] = 'The password you specified was blank.';
69 if ($vars['password'] != $vars['confirmpassword'])
71 $errors[] = 'The passwords you entered did not match.';
74 if (!$vars['password'])
76 $errors[] = 'The password you specified was blank.';
79 if (is_array($DB_sql->query_first("SELECT * FROM " . TABLE_PREFIX
. "user WHERE email = '" . addslasheslike($vars['email']) . "'")))
81 $errors[] = 'The specified email is already in use.';
84 if (is_array($errors))
86 echo implode('<br />', $errors);
90 $salt = fetch_random_chars(15);
92 if ($bugsys->options
['verifyemail'])
98 if ($bugsys->options
['moderatenewusers'])
109 INSERT INTO " . TABLE_PREFIX
. "user
110 (email, displayname, password, salt, authkey, showemail, languageid, usergroupid)
112 ('" . addslasheslike($vars['email']) . "',
113 '" . addslasheslike($vars['displayname']) . "',
114 '" . md5(md5($vars['password']) . md5($salt)) . "',
116 '" . fetch_random_chars() . "',
123 $userid = $DB_sql->insert_id();
125 // Verify email address
126 if ($usergroupid == 3)
128 $activationid = fetch_random_chars(25);
130 $DB_sql->query("INSERT INTO " . TABLE_PREFIX
. "useractivation (userid, activator, dateline, usergroupid) VALUES ($userid, '$activationid', " . NOW
. ", 2)");
132 mymail(addslasheslike($vars['email']), 'Welcome to ' . $bugsys->options
['trackertitle'], "Hi " . addslasheslike($vars['displayname']) . " you need to activate your account: http://devbox/bugtraq/register.php?do=activate&userid=" . $userid . "&activator=" . $activationid);
134 echo 'You now need to activate your account via email.';
136 else if ($usergroupid == 4 OR $usergroupid == 2)
138 if ($bugsys->options
['sendwelcomemail'])
140 mymail(addslasheslike($vars['email']), 'Welcome to ' . $bugsys->options
['trackertitle'], "Hi " . addslasheslike($vars['displayname']) . " and welcome to the " . $bugsys->options
['trackertitle'] . " bug tracker! Thanks for registering.");
143 if ($usergroupid == 4)
145 echo 'Your account is pending approval.';
149 echo 'Registration complete!';
154 // ###################################################################
156 if ($_REQUEST['do'] == 'activate')
158 sanitize(array('userid' => INT, 'activator' => STR
));
160 if ($useractivation = $DB_sql->query_first("SELECT * FROM " . TABLE_PREFIX
. "useractivation WHERE userid = $vars[userid] AND activator = '" . addslasheslike($vars['activator']) . "'"))
162 $DB_sql->query("UPDATE " . TABLE_PREFIX
. "user SET usergroupid = $useractivation[usergroupid] WHERE userid = $vars[userid]");
163 $DB_sql->query("DELETE FROM " . TABLE_PREFIX
. "useractivation WHERE userid = $vars[userid]");
164 echo 'your account is now activated and you can now login';
168 echo 'we could not match your registration string. please make sure you entered the correct url';
172 /*=====================================================================*\
173 || ###################################################################
176 || ###################################################################
177 \*=====================================================================*/