How to create table in Joomla and store user at chat
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.
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.
The PHP code you posted doesn't read that information from the text file. What it does is that it tries to get 3 different integer values:
It looks for a file called online.txt in "chatdatapath", and if found it reads the file, and skips everything except the first line. If the first line contains two | characters, it returns the numbers in that line, which should be like this: "connections|logon_users|room_numbers". If the file is not found, or the format is different, it returns 0 for all the 3 numbers.
So the information about who is online must be somewhere else. It could be it's below the first line? Can you post it? If the file seems to contain the information you want, it's probably possible to make an SQL statement to fill the table from the text file.
Here's a link that explain the SQL to load data from text files into a database table:
I think the code below is the one that actually get the user list (connected to the chat).
Thanks for your help.
I think it would be easier if you just looked at the text files on the server instead of looking at the code. All this code does, is to scan a directory for files which begins with "room_", read them, and return a list of the contents of all the files. It joins the name list with ", " in between the names instead of a newline. If none are found, it returns "None". I think you could get a similar list simply running the command "cat room_*" inside that directory, except the names will be separated with newlines instead of commas.
|All times are GMT -5. The time now is 07:14 AM.|