<?php require "www2-funcs.php"; login_init(); bbs_session_modify_user_mode(BBS_MODE_FRIEND); assert_login(); page_header("在线好友列表"); $friends = bbs_getonlinefriends(); if ($friends == 0) { $num = 0; } else { $num = count($friends); } ?> <table class="main adj"> <col class="center"/><col/><col/><col/><col/><col/><col class="right"/> <tbody> <tr><th>序号</th><th>友</th><th>使用者代号</th><th>使用者昵称</th><th>来自</th><th>动态</th><th>发呆</th></tr> <?php for ($i = 0; $i < $num; $i++) { echo "<tr><td>" . ($i + 1) . "</td>"; echo "<td>√"; if ($friends[$i]["invisible"]) { echo "C"; } else { echo " "; } ?> </td> <td><a href="bbsqry.php?userid=<?php echo $friends[$i]["userid"];
/** * function getOnlineFriends get my online friends * online friends has more info * * @return array the element is User * @access public */ public function getOnlineFriends() { $friends = array(); $ret = bbs_getonlinefriends(); if ($ret == 0) { return array(); } foreach ($ret as $v) { $info = array(); if (bbs_getuser($v['userid'], $info) == 0) { throw new UserNullException(); } $friends[] = new User($info, $v); } return $friends; }