Skip to content

Commit

Permalink
mod/chat - use empty value instead of erroring out if $USER->lastIP a…
Browse files Browse the repository at this point in the history
…nd getremoteaddr() don't yield any interesting value

Sometimes we can't get any useful IP for the user -- and this may even be a
valid situation. So fudge an empty value -- the DB needs it as the IP field
is NOT NULL.
  • Loading branch information
martinlanghoff committed Apr 19, 2006
1 parent ef45822 commit f83edcb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mod/chat/lib.php
Expand Up @@ -390,11 +390,11 @@ function chat_login_user($chatid, $version, $groupid, $course) {

// Sometimes $USER->lastIP is not setup properly
// during login. Update with current value if possible
// or error out clearly.
// or provide a dummy value for the db
if (empty($chatuser->ip)) {
$chatuser->ip = getremoteaddr();
if (empty($chatuser->ip)) {
error("Cannot determine the IP address of the user!");
$chatuser->ip = '';
}
}

Expand Down

0 comments on commit f83edcb

Please sign in to comment.