|
From: Benjamin C. <bc...@us...> - 2001-12-13 14:00:40
|
Update of /cvsroot/phpbt/phpbt
In directory usw-pr-cvs1:/tmp/cvs-serv15119
Modified Files:
newaccount.php
Log Message:
Fix the insert for the user group
Index: newaccount.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/newaccount.php,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- newaccount.php 2001/11/19 16:49:20 1.22
+++ newaccount.php 2001/12/13 14:00:35 1.23
@@ -36,9 +36,11 @@
$error = $STRING['givelogin'];
elseif (!$_pv['email'] or !valid_email($_pv['email']))
$error = $STRING['giveemail'];
- elseif ($q->grab_field("select user_id from ".TBL_AUTH_USER." where email = '{$_pv['email']}' or login = '{$_pv['login']}'"))
+ elseif ($q->grab_field("select user_id from ".TBL_AUTH_USER.
+ " where email = '{$_pv['email']}' ".
+ (!empty($_pv['login']) ? "or login = '{$_pv['login']}'" : '')))
$error = $STRING['loginused'];
- if ($error) {
+ if (!empty($error)) {
show_form($error);
return;
}
@@ -58,8 +60,10 @@
$user_id = $q->nextid(TBL_AUTH_USER);
$q->query("insert into ".TBL_AUTH_USER." (user_id, login, first_name, last_name, email, password, active, created_date, last_modified_date)"
." values ($user_id, '$login', '$firstname', '$lastname', '{$_pv['email']}', '$mpassword', 1, $now, $now)");
- $q->query("insert into ".TBL_USER_GROUP." (user_id, group_id)"
- ." select $user_id, group_id from ".TBL_AUTH_GROUP." where group_name = 'user'");
+ $q->query("insert into ".TBL_USER_GROUP.
+ " (user_id, group_id, created_by, created_date)
+ select $user_id, group_id, 0, $now from ".TBL_AUTH_GROUP.
+ " where group_name = 'User'");
mail($_pv['email'], $STRING['newacctsubject'], sprintf($STRING['newacctmessage'],
$password), sprintf("From: %s\nContent-Type: text/plain; charset=%s\nContent-Transfer-Encoding: 8bit\n",ADMIN_EMAIL, $STRING['lang_charset']));
$t->set_file('content','newaccountsuccess.html');
|