Community Support for OpenDocMan (Deprecated)

Full Version: Problem with adding users
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
iblazev


2007-07-15 06:52:40 PDT
Hello!
I have PHP 5.2.3, Apache 2.2.4, MySQL 5.0 and OpenDocMan 1.2.5 and installation went well. I tested it with a few files and departements and admin acc and it worked but when I tried to add another user this error apeared:

Error in query: INSERT INTO user (id, username, password, department, phone, Email,last_name, first_name) VALUES('', 'kjk', password('fe7qu'), '1' ,'123 132','[email protected]', 'misko', 'misko' ). Incorrect integer value: '' for column 'id' at row 1

Can anyone tell me what should I try to fix it?
Thanx!
iblazev


2007-07-16 00:48:35 PDT
OK, found the problem: it looks like id function which increases id doesn't work right. It gives null value. Don't know if this is a no-compatibility bug with MySQL 5. When updating database manually, it works fine. Which is, actually, better since admin is the one who shoud add or remove users and themselves.
Anyway.. great applicationSmile
cherrymount


2007-07-18 16:14:47 PDT
I believe your problem is with new security features in mysql version 5. I had the same one and it was easily fixed.
Go to your mysql command prompt: and type 'SET sql_mode = '';'

mysql> SET sql_mode = '';

That worked for me!!!
iblazev


2007-07-18 23:36:29 PDT
Still not working. This is copied from the error message window that pops up when adding new user:

Line: 115
Char: 2
Error: 'conf_password.value' is null or not an object
Code: 0
URL: myserver.com/user.php
middle_road


2007-10-16 23:02:30 PDT
OK, need a bit of handholding here,
I'm trying to get the same system up & running
but can't figure out where the 'SET sql_mode = '';' syntax/variable has to go
or the proper what to implement it.
I've tried everything I could from the searches and such but no luck.
phpMyAdmin still shows :-
sql mode STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Need some detailed 'how-to' info I'm afraid...

TIA

_mr
cnstim


2007-11-01 14:19:16 PDT
I am having the same problem.
Thanks cherrymount for you suggestion, but unfortunately, it didnt fix the problem for me.
Was anything else you might suggest trying?
amalsp


2007-11-01 20:40:19 PDT
Hi,

I had the same problem. I had to edit the sql where the user was added and remove the id parts from it. Let the db handle the id. It is set to auto increment when a record is inserted.

In file commitchange.php

Existing line
$query = "INSERT INTO user (id, username, password, department, phone, Email,last_name, first_name) VALUES('', '". addslashes($_POST['username'])."', password('". addslashes(@$_POST['password']) ."'), '" . addslashes($_POST['department'])."' ,'" . addslashes($phonenumber) . "','". addslashes($_POST['Email'])."', '" . addslashes($_POST['last_name']) . "', '" . addslashes($_POST['first_name']) . '\' )';


Modified line
$query = "INSERT INTO user (username, password, department, phone, Email,last_name, first_name) VALUES('". addslashes($_POST['username'])."', password('". addslashes(@$_POST['password']) ."'), '" . addslashes($_POST['department'])."' ,'" . addslashes($phonenumber) . "','". addslashes($_POST['Email'])."', '" . addslashes($_POST['last_name']) . "', '" . addslashes($_POST['first_name']) . '\' )';


This worked for me. Hope it does for you too.

Amal



cnstim


2007-11-03 21:23:02 PDT
Amal
Thankyou, that mofified query did the trick for that problem
Unfortuanelty it just got me to the next step (adding the user to admin now has errors)
I am no expert in this area, but I am wondering if the trouble I am having is related to "null" values being returned, versus "0" value.
I have installed opendoc man on a windows xp/my sql/and php, all updated to latest releses.
I will continue to investigate, and post any results I may find, but if anyone has a heads up on this issue???
Can I change mysql to always return a "0" instead of "null" (or is that a dangerous idea?)
Is is php change?
Or is a lot of code change for windows...???

Cheers
Tim
amalsp


2007-11-29 23:36:16 PST
Hi Tim,

Sorry i was not able to look at this for a long time. But finally got arount to it. The problem is that if you do not tick the admin option the program is trying to make the field a space. But the db field if numeric. So changing

//$_POST['admin']='';

to
$_POST['admin']=0;

in commitchange.php solves this issue.

Also when removing admin permission (modify user)

change //$_POST['admin'] = 'no';

to if(!isset($_POST['admin']) || $_POST['admin'] == '')
{
$_POST['admin'] = 0;
}else
{
$_POST['admin'] = 1;
}

Regards

Amal
iomperkins


2008-08-11 13:03:20 PDT
Amal

thanks for that worked perfectly.

paul
spacebaby


2008-12-11 10:58:22 PST
These same changes have to be applied to signup.php as well, if you want to avoid this problem when users create their own accounts.
spacebaby


2008-12-11 10:58:37 PST
These same changes have to be applied to signup.php as well, if you want to avoid this problem when users create their own accounts.