示例#1
0
 /**
  * void Online::updateUser (&$user, &$target)
  * Update's $user's status to $target
  */
 function updateUser(&$user, &$target)
 {
     $dbh = Planworld::_connect();
     $query = "UPDATE online SET last_access=" . mktime() . ", what='";
     if (is_object($target)) {
         $query .= $target->getUsername();
     } else {
         $query .= addslashes($target);
     }
     $query .= "' WHERE uid=" . $user->getUserID();
     $result = $dbh->query($query);
     if (isset($result) && !DB::isError($result)) {
         if ($dbh->affectedRows() < 1) {
             return Online::addUser($user, $target);
         } else {
             return true;
         }
     } else {
         return PLANWORLD_ERROR;
     }
 }