mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
got rid of update_user_in_db, see bug 1833
This commit is contained in:
parent
222ac91bc9
commit
0475502255
3 changed files with 0 additions and 30 deletions
|
@ -987,28 +987,6 @@ function get_user_info_from_db($field, $value) {
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates user record to record their last access
|
|
||||||
*
|
|
||||||
* longdesc
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function update_user_in_db() {
|
|
||||||
|
|
||||||
global $db, $USER, $REMOTE_ADDR, $CFG;
|
|
||||||
|
|
||||||
if (!isset($USER->id))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
$timenow = time();
|
|
||||||
if ($db->Execute("UPDATE {$CFG->prefix}user SET lastIP='$REMOTE_ADDR', lastaccess='$timenow'
|
|
||||||
WHERE id = '$USER->id' ")) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does this username and password specify a valid admin user?
|
* Does this username and password specify a valid admin user?
|
||||||
|
|
|
@ -395,9 +395,6 @@ function require_login($courseid=0, $autologinguest=true) {
|
||||||
print_header();
|
print_header();
|
||||||
notice(get_string("studentnotallowed", "", fullname($USER, true)), "$CFG->wwwroot/");
|
notice(get_string("studentnotallowed", "", fullname($USER, true)), "$CFG->wwwroot/");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else { // just update their last login time
|
|
||||||
update_user_in_db();
|
|
||||||
}
|
}
|
||||||
return; // user is a member of this course.
|
return; // user is a member of this course.
|
||||||
}
|
}
|
||||||
|
@ -415,7 +412,6 @@ function require_login($courseid=0, $autologinguest=true) {
|
||||||
notice(get_string("guestsnotallowed", "", $course->fullname));
|
notice(get_string("guestsnotallowed", "", $course->fullname));
|
||||||
break;
|
break;
|
||||||
case 1: // Guests allowed
|
case 1: // Guests allowed
|
||||||
update_user_in_db();
|
|
||||||
return;
|
return;
|
||||||
case 2: // Guests allowed with key (drop through)
|
case 2: // Guests allowed with key (drop through)
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -57,10 +57,6 @@
|
||||||
$USER->lastname = " ";
|
$USER->lastname = " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!update_user_in_db()) {
|
|
||||||
error("Weird error: User not found");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!update_user_login_times()) {
|
if (!update_user_login_times()) {
|
||||||
error("Wierd error: could not update login records");
|
error("Wierd error: could not update login records");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue