<?php

#############################################################################
#                              Site@School Chat module
# Site@School is a website management system designed for schools.
# This is a chat module which can be used in Site@School.
#
# coded by Fred Stuurman (fc.stuurman@hccnet.nl)
#############################################################################
#		based on 	CHATNESS v2		 see http://www.chatness.us/
#		BY: Stephen Craton
#   Altered for Site@School with consent of the author
#############################################################################
# users.php: last changed 05/10/2006  , version: 2.4.10
#              by Fred Stuurman (fc.stuurman@hccnet.nl)
#$Id: users.php,v 1.2 2006/10/15 19:08:53 fstuurman Exp $
############################################################################
#                        LICENSE INFORMATION
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
##############################################################################
define('IN_SAS', true);

include ("../../configuration/database.inc.php");
mysql_connect("$db_server", "$db_username", "$db_password");
mysql_select_db("$db_name");
require ("../../core/session.php"); //build a session

if (!IsSet ($_SESSION['Chat_Username']))
{
	exit;
}

$chats_usertable = $dbprefix . "m_chat_users";

$result = mysql_query("SELECT user, status FROM $chats_usertable WHERE room = '$_SESSION[Chat_ID]'");

if (!isset ($_SESSION['ignores']))
{
	$_SESSION['ignores'] = '';
}

echo '<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"><tr><td align="left" valign="top">';

while ($users_list = mysql_fetch_array($result))
{
	$status = $users_list[1];
	echo '<img src="person.gif"><font face="Arial" size="2">' . $users_list[0];
	if ($status == 'idle')
	{
		echo " <font size=\"1\"><i>(Idle)</i></font>";
	}
	echo '</font></br>';
}
echo '</td></tr></table>';
?>