<![CDATA[ Adding Web User via Manager - IIS - My Forums]]> https://forums.modx.com/thread/?thread=17126 <![CDATA[Re: Adding Web User via Manager - IIS]]> https://forums.modx.com/thread/17126/adding-web-user-via-manager---iis?page=2#dis-post-93158
I just tried modx-0.9.6-rc3 with MySQL in strict mode. Unfortunately, the creation of new manager and web users still fails. For example, data is getting written to the [modx_]web_users table, but not [modx_]web_user_attributes.]]>
dwalters May 23, 2007, 05:34 PM https://forums.modx.com/thread/17126/adding-web-user-via-manager---iis?page=2#dis-post-93158
<![CDATA[Re: Adding Web User via Manager - IIS]]> https://forums.modx.com/thread/17126/adding-web-user-via-manager---iis?page=2#dis-post-93157
Thanks for your feedback on this issue.

Zap,
Yes, I’m definitely in favour of modifying the SQL to respecct MySQL 5 strict mode. Has this change been slated for a future MODx release?

Ryan,
I’ll check out the new snapshot from SVN. I suspect that may contain the answer to my question above.

Thanks again.


]]>
dwalters Apr 22, 2007, 04:29 PM https://forums.modx.com/thread/17126/adding-web-user-via-manager---iis?page=2#dis-post-93157
<![CDATA[Re: Adding Web User via Manager - IIS]]> https://forums.modx.com/thread/17126/adding-web-user-via-manager---iis?page=2#dis-post-93156 rethrash Apr 13, 2007, 11:51 AM https://forums.modx.com/thread/17126/adding-web-user-via-manager---iis?page=2#dis-post-93156 <![CDATA[Re: Adding Web User via Manager - IIS]]> https://forums.modx.com/thread/17126/adding-web-user-via-manager---iis?page=2#dis-post-93155 ZAP Apr 10, 2007, 01:30 AM https://forums.modx.com/thread/17126/adding-web-user-via-manager---iis?page=2#dis-post-93155 <![CDATA[Re: Adding Web User via Manager - IIS]]> https://forums.modx.com/thread/17126/adding-web-user-via-manager---iis?page=2#dis-post-93154
As indicated above, It seems MODx 0.9.5 does not play well with MySQL 5 when the SQL Mode is set to ’STRICT_TRANS_TABLES, NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION’. In this condition the creation of new web users will fail, as will the updates to the details for the Built-in Administration account. This is because MODx inserts empty PHP variables into fields that are set to NOT NULL. See related bugs: http://modxcms.com/bugs/task/167

My suggested workaround involves modifying how these empty empty PHP variables are handled in ’save_web_user.processor.php’ (and possibly ’save_user.processor.php’ too). The variables in question are ’role’, ’gender’, ’dob’, ’blocked’, ’blockeduntil’ and ’blockedafter’. I substituted the block of code starting at about line 34 with the code below and found I could then add new web users without error. You may find you have to modify an identical block in ’save_user.processor.php’

$id = intval($_POST[’id’]);
$oldusername = $_POST[’oldusername’];
$newusername = !empty ($_POST[’newusername’]) ? $_POST[’newusername’] : "New User";
$fullname = mysql_escape_string($_POST[’fullname’]);
$genpassword = $_POST[’newpassword’];
$passwordgenmethod = $_POST[’passwordgenmethod’];
$passwordnotifymethod = $_POST[’passwordnotifymethod’];
$specifiedpassword = $_POST[’specifiedpassword’];
$email = mysql_escape_string($_POST[’email’]);
$oldemail = $_POST[’oldemail’];
$phone = mysql_escape_string($_POST[’phone’]);
$mobilephone = mysql_escape_string($_POST[’mobilephone’]);
$fax = mysql_escape_string($_POST[’fax’]);
//$dob = ConvertDate($_POST[’dob’]); /* Changed to comply with MySQL 5 strict data integrity checks */
$dob = !empty ($_POST[’dob’]) ? $_POST[’dob’] : 0;
$country = $_POST[’country’];
$state = mysql_escape_string($_POST[’state’]);
$zip = mysql_escape_string($_POST[’zip’]);
// $gender = $_POST[’gender’]; /* Changed to comply with MySQL 5 strict data integrity checks */
$gender = !empty ($_POST[’gender’]) ? $_POST[’gender’] : 0;
$photo = mysql_escape_string($_POST[’photo’]);
$comment = mysql_escape_string($_POST[’comment’]);
//$roleid = $_POST[’role’]; /* Changed to comply with MySQL 5 strict data integrity checks */
$roleid = !empty ($_POST[’role’]) ? $_POST[’role’] : 0;
$failedlogincount = $_POST[’failedlogincount’];
//$blocked = $_POST[’blocked’]; /* Changed to comply with MySQL 5 strict data integrity checks */
$blocked = !empty ($_POST[’blocked’]) ? $_POST[’blocked’] : 0;
//$blockeduntil = ConvertDate($_POST[’blockeduntil’]); /* Changed to comply with MySQL 5 strict data integrity checks */
$blockeduntil = !empty ($_POST[’blockeduntil’]) ? $_POST[’blockeduntil’] : 0;
//$blockedafter = ConvertDate($_POST[’blockedafter’]); /* Changed to comply with MySQL 5 strict data integrity checks */
$blockedafter = !empty ($_POST[’blockedafter’]) ? $_POST[’blockedafter’] : 0;
$user_groups = $_POST[’user_groups’];
]]>
dwalters Mar 08, 2007, 03:32 AM https://forums.modx.com/thread/17126/adding-web-user-via-manager---iis?page=2#dis-post-93154
<![CDATA[Re: Adding Web User via Manager - IIS]]> https://forums.modx.com/thread/17126/adding-web-user-via-manager---iis?page=2#dis-post-93153
I have also come to grief with this error. I have MODx 0.9.5 running on Windows Server 2003 Standard, IIS 6.0, PHP: 5.1.6 and MySQL: 5.0.16-nt.

I don’t have the option of using the ’SET GLOBAL SQL_MODE=’’;’ workaround suggested above. Could anyone recommend the best way of implementing the ’SET SESSION SQL_MODE=’’;’ workaround instead?

My first preference would be to correct the PHP variable that’s submitting invalid data to MySQL. I’m still going over the code in ’mutate_user.dynamic.php’ (which I think is the right file) to see if anything looks out of place. If anyone with a better understanding of MODx internals could point me in the right direction that would be much appreciated.

Thanks for your help.

]]>
dwalters Mar 07, 2007, 03:56 AM https://forums.modx.com/thread/17126/adding-web-user-via-manager---iis?page=2#dis-post-93153
<![CDATA[Re: Adding Web User via Manager - IIS]]> https://forums.modx.com/thread/17126/adding-web-user-via-manager---iis?page=2#dis-post-93152
When you install MySQL and run the Instance configuration wizard, you have the choice of either a Standard Configuration or a Custom Configuration. I took the Custom one, which has "Enable Strict Mode" checked by default. This is what puts the Strict rules into the SQL_MODE variable.

In principle, I think that is a good thing but as that article suggests some developers don’t. It appears anyway that ModX was built with the Strict mode turned off.

If strict mode is on then it breaks the "add web user" as well as the "add role" function on my setup. The reason being it seems to be inserting empty php variables into columns that are setup with NOT NULL.

So some possible longer term solutions/options could be:

  • Check the MySQL SQL_MODE variable state in the ModX install wizard
  • Set the SQL_MODE after every MySQL connect
  • Fix the bits in the code that tries to insert invalid data

I like the last option of course smiley But it may not just be the Add Web User and Add Role functions that are affected.

Thanks again.
]]>
aicos Feb 11, 2007, 09:51 AM https://forums.modx.com/thread/17126/adding-web-user-via-manager---iis?page=2#dis-post-93152
<![CDATA[Re: Adding Web User via Manager - IIS]]> https://forums.modx.com/thread/17126/adding-web-user-via-manager---iis#dis-post-93151
And as this error is on my development machine, mysql security isn’t an issue as nothing other than me can use it!

I only have modx on the database on my laptop so did it for the whole thing.

This appears to be a MySQL 5 issue, to do with data integrity not a windows issue as I thought from the posts.
See http://dev.mysql.com/tech-resources/articles/mysql-data-integrity.html

Surprised it hasn’t been caught before.]]>
markvr Jan 11, 2007, 11:04 AM https://forums.modx.com/thread/17126/adding-web-user-via-manager---iis#dis-post-93151
<![CDATA[Re: Adding Web User via Manager - IIS]]> https://forums.modx.com/thread/17126/adding-web-user-via-manager---iis#dis-post-93150 Quote from: markvr at Jan 11, 2007, 04:49 PM

SOLUTION:

log into the mysql command program (ie "mysql - u root -p")and issue this command:
SET GLOBAL SQL_MODE=’’;

Some reading:


You can change the SQL mode at runtime by using a SET [GLOBAL|SESSION] sql_mode=’modes’ statement to set the sql_mode system value. Setting the GLOBAL variable requires the SUPER privilege and affects the operation of all clients that connect from that time on. Setting the SESSION variable affects only the current client. Any client can change its own session sql_mode value at any time.

Why would GLOBAL be the better choice over, say, SESSION, in this case? (Good work, BTW) Further, it might not require SUPER privileges, and could be done via SQL/mysql_query ? (...shared hosting users?)]]>
pixelchutes Jan 11, 2007, 10:55 AM https://forums.modx.com/thread/17126/adding-web-user-via-manager---iis#dis-post-93150
<![CDATA[Re: Adding Web User via Manager - IIS]]> https://forums.modx.com/thread/17126/adding-web-user-via-manager---iis#dis-post-93149
log into the mysql command program (ie "mysql - u root -p")and issue this command:
SET GLOBAL SQL_MODE=’’;

]]>
markvr Jan 11, 2007, 10:49 AM https://forums.modx.com/thread/17126/adding-web-user-via-manager---iis#dis-post-93149