示例#1
0
 /* this assumes that note_user has been set as a session variable
  somewhere in the auth system */
 $_user = User::factory($_SESSION['note_user']);
 /* update this user's last login */
 $_user->setLastLogin(mktime());
 /* update this user's last known ip address */
 $_user->setLastIP($_SERVER['REMOTE_ADDR']);
 /* save it to prevent planwatch weirdness */
 $_user->save();
 /* create an object representing the target user (or a string representing the page) */
 if (isset($_GET['id'])) {
     $section = str_replace(' ', '', $_GET['id']);
     if ($section == $_user->getUsername()) {
         $_target =& $_user;
     } else {
         if (Planworld::isValidUser($section)) {
             $_target = User::factory($section);
         } else {
             if ($section == 'random') {
                 $_target = User::factory(Planworld::getRandomUser());
             } else {
                 $_target = $section;
             }
         }
     }
     /* force fetching of update / login times if the target user is remote */
     if (is_object($_target) && $_target->getType() == 'planworld') {
         $_target->forceUpdate();
     }
 }
 /* update the current status of online users (including this one) */