Page Chapter 6. Working with Users, Page 66
This heading and subsequent text is inaccurate and misleading.
Change the heading and explanatory text to
Testing If a User is an Anonymous or Authenticated User
If $user->uid is 0 it indicates an anonymous user; if it is not 0 then it indicates an authenticated or registered user. An authenticated user will be given a uid which is the primary key into the users table. I cannot find any field that will provide accurate information on whether a user is currently logged on or not. The user->login field will have a timestamp but that only indicates the time of last login, not the current logged in state.
[You are thinking about this too hard. During a request, the global $user variable will have uid->0 if the current user is anonymous (i.e., not logged in). That's all we're testing. I probably should have stated that the test is during the request. -JV]
