Index: moodlelib.php =================================================================== RCS file: /cvsroot/moodle/moodle/lib/moodlelib.php,v retrieving revision 1.960.2.101 diff -u -r1.960.2.101 moodlelib.php --- lib/moodlelib.php 22 Oct 2008 02:33:11 -0000 1.960.2.101 +++ lib/moodlelib.php 23 Oct 2008 01:09:21 -0000 @@ -3384,8 +3384,10 @@ $user->lastname = ' '; } - $user->sesskey = random_string(10); - $user->sessionIP = md5(getremoteaddr()); // Store the current IP in the session + if (isset($_SERVER['REMOTE_ADDR'])) { + $user->sesskey = random_string(10); + $user->sessionIP = md5(getremoteaddr()); // Store the current IP in the session + } return $user; }