]>
src.bluestatic.org Git - bugdar.git/blob - register.php
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 echo 'Sorry, you are already registered!' ;
27 if (! $bugsys- > options
[ 'allownewreg' ])
29 echo '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 $errors [] = 'The emails you entered do not match.' ;
55 if (! $bugsys- > in
[ 'email' ])
57 $errors [] = 'The password you specified was blank.' ;
60 if ( $bugsys- > in
[ 'password' ] != $bugsys- > in
[ 'confirmpassword' ])
62 $errors [] = 'The passwords you entered did not match.' ;
65 if (! $bugsys- > in
[ 'password' ])
67 $errors [] = 'The password you specified was blank.' ;
70 if (! $funct- > is_valid_email ( $bugsys- > in
[ 'email' ]))
72 $errors [] = 'The specified email is invalid.' ;
75 if ( is_array ( $db- > query_first ( "SELECT * FROM " . TABLE_PREFIX
. "user WHERE email = '" . $bugsys- > in
[ 'email' ] . "'" )))
77 $errors [] = 'The specified email is already in use.' ;
80 if ( is_array ( $errors ))
82 echo implode ( '<br />' , $errors );
86 $salt = $funct- > rand ( 15 );
88 if ( $bugsys- > options
[ 'verifyemail' ])
94 if ( $bugsys- > options
[ 'moderatenewusers' ])
105 INSERT INTO " . TABLE_PREFIX
. "user
106 (email, displayname, password, salt, authkey, showemail, languageid, usergroupid)
108 ('" . $bugsys- > in
[ 'email' ] . "',
109 '" . $bugsys- > in
[ 'displayname' ] . "',
110 '" . md5 ( md5 ( $bugsys- > in
[ 'password' ]) . md5 ( $salt )) . "',
112 '" . $funct- > rand () . "',
113 " . intval ( $bugsys- > in
[ 'showemail' ]) . ",
114 " . intval ( $bugsys- > in
[ 'languageid' ]) . ",
119 $userid = $db- > insert_id ();
121 // Verify email address
122 if ( $usergroupid == 3 )
124 $activationid = $funct- > rand ( 25 );
126 $db- > query ( "INSERT INTO " . TABLE_PREFIX
. "useractivation (userid, activator, dateline, usergroupid) VALUES ( $userid , ' $activationid' , " . NOW
. ", 2)" );
128 $mail- > to
= $bugsys- > in
[ 'email' ];
129 $mail- > subject
= 'Welcome to ' . $bugsys- > options
[ 'trackertitle' ];
130 $mail- > body
= "Hi " . $bugsys- > in
[ 'displayname' ] . " you need to activate your account: http://devbox/bugtraq/register.php?do=activate&userid=" . $userid . "&activator=" . $activationid ;
133 echo 'You now need to activate your account via email.' ;
135 else if ( $usergroupid == 4 OR $usergroupid == 2 )
137 if ( $bugsys- > options
[ 'sendwelcomemail' ])
139 $mail- > to
= $bugsys- > in
[ 'email' ];
140 $mail- > subject
= 'Welcome to ' . $bugsys- > options
[ 'trackertitle' ];
141 $mail- > body
= "Hi " . $bugsys- > in
[ 'displayname' ] . " and welcome to the " . $bugsys- > options
[ 'trackertitle' ] . " bug tracker! Thanks for registering." ;
145 if ( $usergroupid == 4 )
147 echo 'Your account is pending approval.' ;
151 echo 'Registration complete!' ;
156 // ###################################################################
158 if ( $_REQUEST [ 'do' ] == 'activate' )
160 if ( $useractivation = $db- > query_first ( "SELECT * FROM " . TABLE_PREFIX
. "useractivation WHERE userid = " . intval ( $bugsys- > in
[ 'userid' ]) . " AND activator = '" . $bugsys- > in
[ 'activator' ] . "'" ))
162 $db- > query ( "UPDATE " . TABLE_PREFIX
. "user SET usergroupid = $useractivation [usergroupid] WHERE userid = " . intval ( $bugsys- > in
[ 'userid' ]));
163 $db- > query ( "DELETE FROM " . TABLE_PREFIX
. "useractivation WHERE userid = " . intval ( $bugsys- > in
[ '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 \*=====================================================================*/