Projects ⇒ Bugs ⇒ #892: MySQL 5.0 Strict User Approval ⇒ CPG Dragonfly™ CMS
Bug #892 MySQL 5.0 Strict User Approval
Project: Dragonfly 9.0.3 -> 9.3 Category: SQL
Submitted: Tuesday, January 16, 2007 (21:52:30) Modified: Thursday, January 18, 2007 (12:07:54)
Status: Closed Assigned to:
PHP Version: 4.4.4 HTTPD Server: Apache 1.3

View/Vote Add Comment

by: BrokenCrust
Description:
------------
The user approval process generates an SQL error in MySQL 5.0 Strict mode.

CMS Warning line 75: On /admin.php?op=users While executing query "INSERT INTO cpg_users (username,user_email,user_password,user_regdate,user_website,name,femail,user_icq,user_aim,user_yim,user_msnm,user_from,user_occ,user_interests,user_sig,bio,user_timezone,user_dateformat,newsletter,user_viewemail,user_allow_viewonline,user_attachsig,user_allowhtml,user_allowbbcode,user_allowsmile,user_notify,user_notify_pm,user_popup_pm,theme,user_dst,user_skype,user_lang, user_level) VALUES ('Mr.Robert','test@brokencrust.eu','2acba7f51acfd4fd5102ad090fc612ee','1168977926','','','','','','','','','','','','','0','D M d, Y g:i a','0','0','1','0','1','1','1','0','0','0','','0','','english', 1)" the following error occured: Field 'user_avatar' doesn't have a default value In: c:\cpgtest\html\admin\modules\users_wait.inc on line: 129

Reproduce code:
---------------
Add a user and manually approve them (probably happens is thay approve themselves as well).

Expected result:
----------------
User should be approved with SQL error.

Actual result:
--------------
Approval fails with SQL error.
by: NanoCaiordo
Index: admin/modules/users_wait.inc =================================================================== RCS file: /cvs/html/admin/modules/users_wait.inc,v retrieving revision 9.7 diff -u -r9.7 users_wait.inc --- admin/modules/users_wait.inc 3 Jun 2006 17:47:27 -0000 9.7 +++ admin/modules/users_wait.inc 17 Jan 2007 00:33:22 -0000 @@ -126,7 +126,7 @@ $values .= "'".Fix_Quotes($value)."',"; } } - $db->sql_query("INSERT INTO ".$user_prefix."_users ($fields user_level) VALUES ($values 1)"); + $db->sql_query("INSERT INTO ".$user_prefix."_users ($fields user_level, user_avatar) VALUES ($values 1, '')"); } $db->sql_query("DELETE FROM ".$user_prefix."_users_temp WHERE user_id IN ($_POST[members])"); url_redirect(adminlink('users'));

Not sure about new user registration yet.
by: BrokenCrust
Fixed approval process. Thank you.
by: NanoCaiordo
This bug has been fixed in the CVS.

Snapshots of the sources are packaged every 6 hours; this change
will be in the next snapshot. You can grab the snapshot at the
Downloads section.

Thank you for the report, and for helping us to make Dragonfly 9.0.3 -> 9.1 better.

Index: modules/Your_Account/functions.php =================================================================== RCS file: /cvs/html/modules/Your_Account/functions.php,v retrieving revision 9.21 diff -u -r9.21 functions.php --- modules/Your_Account/functions.php 30 Dec 2006 13:09:17 -0000 9.21 +++ modules/Your_Account/functions.php 18 Jan 2007 11:40:47 -0000 @@ -66,7 +66,7 @@ cpg_error('Required field "'.$info.'" can\'t be empty'); } else { $val = Fix_Quotes($input[$var], 1); - if (strlen($val) > 0) { + //if (strlen($val) > 0) { if ($row['type'] == 1 || $row['type'] == 4) $val = intval($val); elseif ($row['type'] != 3) $val = substr($val,0,$row['size']); $fieldlist .= ", ".$row['field']; @@ -79,7 +79,7 @@ $fieldlist .= ', user_dst'; $valuelist .= ', '.$fields['user_dst']; } - } + //} } } return $content;
Index: modules/Your_Account/register.php =================================================================== RCS file: /cvs/html/modules/Your_Account/register.php,v retrieving revision 9.29 diff -u -r9.29 register.php --- modules/Your_Account/register.php 28 Sep 2006 11:37:38 -0000 9.29 +++ modules/Your_Account/register.php 18 Jan 2007 12:03:52 -0000 @@ -290,6 +290,10 @@ $fieldlist .= ', user_dst'; $valuelist .= ', '.$row['user_dst']; } + if (empty($val)) { + $fieldlist .= ", $field"; + $valuelist .= ", ''"; + } } $db->sql_query('INSERT INTO '.$user_prefix."_users (username, user_email, user_password, user_avatar, user_regdate, user_lastvisit $fieldlist) VALUES ('$row[username]', '$row[user_email]', '$row[user_password]', '".$MAIN_CFG['avatar']['default']."', '$row[user_regdate]', '$row[time]' $valuelist)"); if ($user_cfg['send_welcomepm']) {
User Info

Welcome Anonymous



(Register)
Community

Support for DragonflyCMS in a other languages:

Deutsch
Español