Permalink
Browse files

MDL-19628 Store 0.0.0.0 in user table and log tables if IP address ca…

…n't be found. I didn't change getremoteaddr in 1.9.
  • Loading branch information...
1 parent e5264d1 commit a4a0264df6b3ec40a0bc52c7fabc9b9cd4a88975 @moodler moodler committed May 20, 2010
Showing with 9 additions and 0 deletions.
  1. +3 −0 lib/datalib.php
  2. +6 −0 lib/moodlelib.php
View
@@ -1992,6 +1992,9 @@ function user_accesstime_log($courseid=0) {
if (defined('MDL_PERFDB')) { global $PERF ; $PERF->dbqueries++;};
$remoteaddr = getremoteaddr();
+ if (empty($remoteaddr)) {
+ $remoteaddr = '0.0.0.0';
+ }
if ($db->Execute("UPDATE {$CFG->prefix}user
SET lastip = '$remoteaddr', lastaccess = $timenow
WHERE id = $USER->id")) {
View
@@ -2968,6 +2968,9 @@ function create_user_record($username, $password, $auth='manual') {
}
$newuser->confirmed = 1;
$newuser->lastip = getremoteaddr();
+ if (empty($newuser->lastip)) {
+ $newuser->lastip = '0.0.0.0';
+ }
$newuser->timemodified = time();
$newuser->mnethostid = $CFG->mnet_localhost_id;
@@ -3137,6 +3140,9 @@ function guest_user() {
$newuser->confirmed = 1;
$newuser->lang = $CFG->lang;
$newuser->lastip = getremoteaddr();
+ if (empty($newuser->lastip)) {
+ $newuser->lastip = '0.0.0.0';
+ }
}
return $newuser;

0 comments on commit a4a0264

Please sign in to comment.