Could not log in to chat room!!

Could not log in to chat room!!

by Diana G -
Number of replies: 14

Please i have serius problems with the chat. te message is

Could not log in to chat room!!

i dont know what can i do?

thanks

Average of ratings: -
In reply to Diana G

Re: Could not log in to chat room!!

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
What version of Moodle are you using?
In reply to Petr Skoda

Re: Could not log in to chat room!!

by Sonia Pestana -

Hello. I have the same problem. Moodle was operating well (1.5). Then I make a new install os Moodle 1.5.1. When I create a Chat, i can´t enter. See the display message

Could not log in to chat room!!

(debug on)

INSERT INTO mdl_chat_users ( ID, CHATID, USERID, GROUPID, VERSION, IP, FIRSTPING, LASTPING, LASTMESSAGEPING, SID, COURSE, LANG ) VALUES ( 11, 11, 2, 0, 'header_js', null, 1121204807, 1121204807, 1121204807, 'BxZnAgsTxetizsjxePeqdXe6psHoKEey', 1, 'pt_br' )

In reply to Sonia Pestana

Re: Could not log in to chat room!!

by Sonia Pestana -

Ooops! I forgot the error message. See bellow:

ERROR: null value in column "ip" violates not-null constraint

INSERT INTO mdl_chat_users ( ID, CHATID, USERID, GROUPID, VERSION, IP, FIRSTPING, LASTPING, LASTMESSAGEPING, SID, COURSE, LANG ) VALUES ( 24, 11, 2, 0, 'header_js', null, 1121268103, 1121268103, 1121268103, 'yFP6teIantN787F7uIGiwaKOIp1G9AaA', 1, 'pt_br' )

In reply to Sonia Pestana

Re: Could not log in to chat room!!

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
Confirming the problem exists, the reason is that "lastIP" in mdl_user table uses UPPER case letters, PostgreSQL converts them into "lastip". Here is a workaround, the patch for CVS will be much more complicated sad ...

Index: lib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/chat/lib.php,v
retrieving revision 1.60
diff -u -r1.60 lib.php --- lib.php 24 Apr 2005 19:18:41 -0000 1.60 +++ lib.php 13 Jul 2005 16:46:50 -0000 @@ -381,7 +381,7 @@ global $USER; if (($version != 'sockets') and $chatuser = get_record_select('chat_users', "chatid='$chatid' AND userid='$USER->id' AND groupid='$groupid'")) { $chatuser->version = $version; - $chatuser->ip = $USER->lastIP; + $chatuser->ip = $USER->lastip; $chatuser->lastping = time(); $chatuser->lang = current_language(); @@ -397,7 +397,7 @@ $chatuser->userid = $USER->id; $chatuser->groupid = $groupid; $chatuser->version = $version; - $chatuser->ip = $USER->lastIP; + $chatuser->ip = $USER->lastip; $chatuser->lastping = $chatuser->firstping = $chatuser->lastmessageping = time(); $chatuser->sid = random_string(32); $chatuser->course = $course->id; //caching - needed for current_language too

In reply to Petr Skoda

Re: Could not log in to chat room!!

by Sonia Pestana -

Thanks very much, skodak! It works!!! boca abertaboca abertaboca aberta

I have made the following tests:

  • New install of Moodle 1.5.1, with PostGree: The chat have problem mencioned above, but with the tip of skodak (changing "lastIP" to "lastip" in mod/chat/lib.php) , the problem was solved boca aberta.
  • New install of Moodle 1.5.1, with MySQL: The chat have problem mencioned above, but changing "lastIP" to "lastip" in mod/chat/lib.php don´t solve the error.


  • Upgrade Moodle 1.5 to 1.5.1, with PostGree: There are no problems: chat works perfectly.


  • Upgrade Moodle 1.5 to 1.5.1, with MySQL: There are no problems: chat works perfectly.
In reply to Sonia Pestana

Re: Could not log in to chat room!!

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
Thanks for the testing!!

here is another quick&dirty patch for new MySQL 4.1 installs only - use only this, not previous (do not forget to logout/login to make it work):

Index: datalib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/datalib.php,v
retrieving revision 1.250.2.2
diff -u -r1.250.2.2 datalib.php --- datalib.php 10 Jul 2005 17:30:32 -0000 1.250.2.2 +++ datalib.php 13 Jul 2005 20:25:24 -0000 @@ -2722,7 +2722,7 @@ echo '<p>Error: Could not insert a new entry to the Moodle log</p>'; // Don't throw an error } if ( isset($USER) && (empty($user) || $user==$USER->id) ) { - $db->Execute('UPDATE '. $CFG->prefix .'user SET lastIP=''. $REMOTE_ADDR .'', lastaccess=''. $timenow .'' + $db->Execute('UPDATE '. $CFG->prefix .'user SET "lastIP"=''. $REMOTE_ADDR .'', lastaccess=''. $timenow .'' WHERE id = ''. $userid .'' '); if ($courseid != SITEID && !empty($courseid)) { // logins etc dont't have a courseid and isteacher will break without it. if (defined('MDL_PERFDB')) { global $PERF ; $PERF->dbqueries++;};

This is getting a bit messy, we must convert them all into lowercase, I have already messaged Martin, I hope we can fix it before 1.5.2 wink

Again, thanks very much for the testing...

skodak
In reply to Sonia Pestana

Re: Could not log in to chat room!!

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
What versions of PostgreSQL and MySQL are you using? Older versions seem fine with current code.

If it's just very new versions of these databases then you may have to downgrade them for now ... I'm looking at changing the column to be named "lastip" but this may have to wait for 1.6 as it will introduce other problems.  On the other hand it's not an important field so these other problems may be minor.   Still weighing it up.
In reply to Martin Dougiamas

Re: Could not log in to chat room!!

by Sonia Pestana -

Thanks Skodak and Martin.

PostGree: PostgreSQL 7.4.2

MySQL: 3.23.58

In reply to Sonia Pestana

Re: Could not log in to chat room!!

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
OK, now I'm confused, Sonia ... these are old versions ... why would you be getting these errors when no-one else has before ... mixed hmm

Eloy just pointed out that operating system may be a factor ... what OS are you using?
In reply to Martin Dougiamas

Re: Could not log in to chat room!!

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
I wonder that it worked in PostgreSQL 7 - the manual states:

Quoting an identifier also makes it case-sensitive, whereas unquoted names are always folded to lower case. For example, the identifiers FOO, foo and "foo" are considered the same by Postgres, but "Foo" and "FOO" are different from these three and each other.

Postgres' folding of unquoted names to lower case is incompatible with the SQL standard, which says that unquoted names should be folded to upper case. Thus, foo should be equivalent to "FOO" not "foo" according to the standard. If you want to write portable applications you are advised to always quote a particular name or never quote it.


Could it be the adodb update that changed the behaviour??
In reply to Petr Skoda

Re: Could not log in to chat room!!

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Might be ADOdb (on retrieving data), but it's still $USER->lastIP on moodle.org. In any case, I've replaced the $USER->lastIP in chat with getremoteaddr() to avoid the issue there entirely. I think that's all we need to do.

The patch above for MySQL 4.1 which quotes the field name seems to go against the actual MySQL documentation, which says that MySQL column names and aliases are always case-insensitive ...
In reply to Martin Dougiamas

Re: Could not log in to chat room!!

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
I like those documentations!

Edit: I agree the getremoteaddr() should be enough.
In reply to Martin Dougiamas

Re: Could not log in to chat room!!

by Sonia Pestana -

Martin, with older versions of Moodle all works perfectly. The problems occurs only with my new installation of Moodle (1.5.1).

PostgreSQL 7.4.2 on i386-redhat-linux-gnu, compiled by GCC i386-redhat-linux-gcc (GCC) 3.3.3 20040216 (Red Hat Linux 3.3.3-2.1)

I have also a problem with the Assignment module after this installation. Some strange... see http://moodle.org/mod/forum/discuss.php?d=27513

Thanks everybody.

In reply to Diana G

Re: Could not log in to chat room!!

by Marcus Fessler -
Does anybody now if this problem is fixed in Version 1.5.2 ?

Kind regards
Marcus