MDL-19628 Store 0.0.0.0 in user table and log tables if IP address can't be found. I didn't change getremoteaddr in 1.9.
This commit is contained in:
@@ -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")) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user