? AND roomid=?"); $rs = $stmt->process(SPY_USERID, $room); } else { $stmt = new Statement("SELECT COUNT(*) AS numb FROM {$GLOBALS['fc_config']['db']['pref']}connections,{$GLOBALS['fc_config']['db']['pref']}rooms WHERE userid IS NOT NULL AND userid <> ? AND ispublic IS NOT NULL AND {$GLOBALS['fc_config']['db']['pref']}connections.roomid = {$GLOBALS['fc_config']['db']['pref']}rooms.id"); $rs = $stmt->process(SPY_USERID); } $rec = $rs->next(); return $rec?$rec['numb']:0; } /** Retrieves a list of the users (by login ID) who are in $room. Leave the $room parameter empty to return a list of all users in all rooms. */ function usersinroom( $room = "" ) { $list = array(); if($room) { $stmt = new Statement("SELECT userid, state, color, lang, roomid FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid IS NOT NULL AND userid <> ? AND roomid=?"); $rs = $stmt->process(SPY_USERID, $room); } else { $stmt = new Statement("SELECT userid, state, color, lang, roomid FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid IS NOT NULL AND userid <> ?"); $rs = $stmt->process(SPY_USERID); } while($rec = $rs->next()) { $usr = ChatServer::getUser($rec['userid']); if($usr == null && $GLOBALS['fc_config']['enableBots']) $usr = $GLOBALS['fc_config']['bot']->getUser($rec['userid']); $list[] = array_merge($usr, $rec); } return $list; } /** Retrieves a list of all available rooms, as an array. */ function roomlist() { $list = array(); // populate $list with the names of all available rooms $stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}rooms WHERE ispublic IS NOT NULL order by ispermanent"); $rs = $stmt->process(); while($rec = $rs->next()) $list[] = $rec; //result will be an array of arrays like ('id' => , 'updated' = , 'created' => , 'name' => , 'ispublic' => , 'ispermanent' => ) return $list; } $rooms = roomlist(); $roomnumb = sizeof($rooms); ?> Who's in the chat?

There are users in rooms.

ID Name Count Users
"; } ?>

Close