Registration Error,phpbb_groups,usercp_register,1062 FIXED!

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Locked
sickmusic
Registered User
Posts: 24
Joined: Fri Oct 25, 2002 1:22 pm
Location: London, UK
Contact:

Registration Error,phpbb_groups,usercp_register,1062 FIXED!

Post by sickmusic » Tue Mar 16, 2004 11:11 am

URL: www.bengali.tk

Template(s) used: subGreen

Any and all MODs: Attach, Glance, Flag, EasyMod, QuickReply, TopicsAnywhere

Do you use a port of phpBB: no

Version of phpBB: 2.0.6

Version of PHP: 4

Which database server and version: mysql 3.23.52

Host: bengalitk.ma.cx

Did someone install this for you/who: no

Is this an upgrade/from what to what: no

Is this a conversion/from what to what: no

Have you searched for your problem: yes

If so, what terms did you try: registration error, usercp_register, phpbb_groups, 1062, duplicate entry

State the nature of your problem:
When a new user fills in the registration form and submits, they get the following error:
Image
after this the user account is set up.. but no confirmation email is sent, even thogh in admin configuraion, i have set this up for the user to do.
i have now changed the admin control panel so that the confirmation email is not required. which has allowed new users to sign in.
ive had a look at the table, and usercp_register.php and cannot spot anything obvious, as im not very good with php/mysql.
but the following is the db structure:
Image
and the following is the snip of usercp_register.php
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_from_flag, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey)
VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '$user_flag', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popup_pm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, 0, 1, ";
if ( $board_config['require_activation'] == USER_ACTIVATION_SELF || $board_config['require_activation'] == USER_ACTIVATION_ADMIN || $coppa )
{
$user_actkey = gen_rand_string(true);
$key_len = 54 - (strlen($server_url));
$key_len = ( $key_len > 6 ) ? $key_len : 6;
$user_actkey = substr($user_actkey, 0, $key_len);
$sql .= "0, '" . str_replace("\'", "''", $user_actkey) . "')";
}
else
{
$sql .= "1, '')";
}

if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
{
message_die(GENERAL_ERROR, 'Could not insert data into users table', '', __LINE__, __FILE__, $sql);
}

$sql = "INSERT INTO " . GROUPS_TABLE . " (group_name, group_description, group_single_user, group_moderator)
VALUES ('', 'Personal User', 1, 0)";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not insert data into groups table', '', __LINE__, __FILE__, $sql);
}

$group_id = $db->sql_nextid();

$sql = "INSERT INTO " . USER_GROUP_TABLE . " (user_id, group_id, user_pending)
VALUES ($user_id, $group_id, 0)";
if( !($result = $db->sql_query($sql, END_TRANSACTION)) )
{
message_die(GENERAL_ERROR, 'Could not insert data into user_group table', '', __LINE__, __FILE__, $sql);
}

if ( $coppa )
{
$message = $lang['COPPA'];
$email_template = 'coppa_welcome_inactive';
}
else if ( $board_config['require_activation'] == USER_ACTIVATION_SELF )
{
$message = $lang['Account_inactive'];
$email_template = 'user_welcome_inactive';
}
else if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
{
$message = $lang['Account_inactive_admin'];
$email_template = 'admin_welcome_inactive';
}
else
{
$message = $lang['Account_added'];
$email_template = 'user_welcome';
}

Any help is greatly appreciated.
Many thanks
Do you have a test account for us:No
Last edited by sickmusic on Tue Mar 16, 2004 12:50 pm, edited 1 time in total.

Graham
Former Team Member
Posts: 8462
Joined: Tue Mar 19, 2002 7:11 pm
Location: UK
Contact:

Post by Graham » Tue Mar 16, 2004 12:40 pm

As you have phpMyAdmin there, can you tell me what the MIN and MAX values in the group_id column are in the phpbb_groups table.

I've only ever seen this error on conversions before, but it may help to rule a few things out.
"So Long, and Thanks for All the Fish"

phpBB Useful Links: Knowledge Base | Userguide | Forum Search | MOD Database | Styles Database
My Links: Blog!

sickmusic
Registered User
Posts: 24
Joined: Fri Oct 25, 2002 1:22 pm
Location: London, UK
Contact:

Post by sickmusic » Tue Mar 16, 2004 12:49 pm

Graham..

yep, i think ur right.. it was the groupid column.

just found the fix:

http://phpbb.com/phpBB/viewtopic.php?t=178808

and its working perfectly now.

i just had to set the groupid field to autoincrement. i think one of the mods may have changed it..

another thing i have noticed which isnt of great importance is deleting users.. i get an error message when trying to delete users who have registered during the period of the above problem.

nevertheless it does not affect the deletion in anysignificant way.

thank you.

Locked

Return to “2.0.x Support Forum”