]>
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 .= "' . $tpl- > fetch ( 'selectoption' ) . '";' );
43 eval ( ' $tpl- >flush("' . $tpl- > fetch ( 'register' ) . '");' );
46 // ###################################################################
48 if ( $_POST [ 'do' ] == 'insert' )
50 sanitize ( array ( 'email' => STR_NOHTML
, 'confirmemail' => STR_NOHTML
, 'displayname' => STR_NOHTML
, 'password' => STR
, 'confirmpassword' => STR
, 'showemail' => INT , 'languageid' => INT ));
52 if ( $vars [ 'email' ] != $vars [ 'confirmemail' ])
54 $errors [] = 'The emails you entered do not match.' ;
59 $errors [] = 'The password you specified was blank.' ;
62 if ( $vars [ 'password' ] != $vars [ 'confirmpassword' ])
64 $errors [] = 'The passwords you entered did not match.' ;
67 if (! $vars [ 'password' ])
69 $errors [] = 'The password you specified was blank.' ;
72 if ( is_array ( $DB_sql- > query_first ( "SELECT * FROM " . TABLE_PREFIX
. "user WHERE email = '" . addslasheslike ( $vars [ 'email' ]) . "'" )))
74 $errors [] = 'The specified email is already in use.' ;
77 if ( is_array ( $errors ))
79 echo implode ( '<br />' , $errors );
83 $salt = fetch_random_chars ( 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 ('" . addslasheslike ( $vars [ 'email' ]) . "',
106 '" . addslasheslike ( $vars [ 'displayname' ]) . "',
107 '" . md5 ( md5 ( $vars [ 'password' ]) . md5 ( $salt )) . "',
109 '" . fetch_random_chars () . "',
116 $userid = $DB_sql- > insert_id ();
118 // Verify email address
119 if ( $usergroupid == 3 )
121 $activationid = fetch_random_chars ( 25 );
123 $DB_sql- > query ( "INSERT INTO " . TABLE_PREFIX
. "useractivation (userid, activator, dateline, usergroupid) VALUES ( $userid , ' $activationid' , " . NOW
. ", 2)" );
125 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 );
127 echo 'You now need to activate your account via email.' ;
129 else if ( $usergroupid == 4 OR $usergroupid == 2 )
131 if ( $bugsys- > options
[ 'sendwelcomemail' ])
133 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." );
136 if ( $usergroupid == 4 )
138 echo 'Your account is pending approval.' ;
142 echo 'Registration complete!' ;
147 // ###################################################################
149 if ( $_REQUEST [ 'do' ] == 'activate' )
151 sanitize ( array ( 'userid' => INT , 'activator' => STR
));
153 if ( $useractivation = $DB_sql- > query_first ( "SELECT * FROM " . TABLE_PREFIX
. "useractivation WHERE userid = $vars [userid] AND activator = '" . addslasheslike ( $vars [ 'activator' ]) . "'" ))
155 $DB_sql- > query ( "UPDATE " . TABLE_PREFIX
. "user SET usergroupid = $useractivation [usergroupid] WHERE userid = $vars [userid]" );
156 $DB_sql- > query ( "DELETE FROM " . TABLE_PREFIX
. "useractivation WHERE userid = $vars [userid]" );
157 echo 'your account is now activated and you can now login' ;
161 echo 'we could not match your registration string. please make sure you entered the correct url' ;
165 /*=====================================================================*\
166 || ###################################################################
169 || ###################################################################
170 \*=====================================================================*/