ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Welcome to LinuxQuestions.org, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

Introduction to Linux - A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

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.

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.

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:
- connections
- logon_users
- room_numbers

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:

The data that I am looking into placing on a table is username, date and something similar to _published_ (connected) which will be 1 for all users loggin into the chat. This way I will be able to get the conection data displayed at the Activity Stream.

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.