Hi:
I need to be able to store users logged at chat server. The chat program stores the login information in a text file (no db). I need a modification so the user info is read from the flat file and stores into a table in Joomla db. I don't have access to source for making the Java Chat Server store the data directly to joomla db is not possible.
Any pointer will be appreciated.
Below if the code that read s the information from Java Chat Server.
Code:
function chat_getChattersFromLocalServer()
{
$room = array();
$room['connections'] = 0;
$room['logon_users'] = 0;
$room['room_numbers'] = 0;
$online_file = $this->chatdatapath."online.txt";
if (!file_exists($online_file))
{
return $room;
}
if (!$row = file($online_file))
{
return $room;
}
$room_data = explode("|", $row[0]);
if (count($room_data) == 3)
{
$room['connections'] = intval($room_data[0]);
$room['logon_users'] = intval($room_data[1]);
$room['room_numbers'] = intval($room_data[2]);
}
return $room;
}
The data that I need is username, online (on / off), date. Regarding the db table, I think this could do the trick:
Code:
CREATE TABLE IF NOT EXISTS `#__chatusers` (
`id` int(10) NOT NULL auto_increment,
`userid` int(10) NOT NULL,
`loginstatus` varchar(15) NOT NULL,
`logdate` datetime default NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM
I need some help because I don't want to mess the db. Also, I am not sure how to make the script store (php) the data into the db. I am not a programmer but can mod this with the guidance and help of LQ.org... I hope someone will help me with this.
Thanks in Advance.