Database Integration -- Install Chat's database (PHP)

There two ways to keep the data. One is using the file format which is the same as the former version, there is no need for users to setup to use, Users' information and chat history are stored under the Chat server path with an encryption; the other is integrating with the present database by PHP interface through which the users' information and chat history store in the database.
1) First please make sure that your web server supports php and MySQL
2) Build MySQL database
please use your MySQL control panel to create a data base named "flashchat".
Operating sql statement of database.sql and build two new data tables: users and log
"users" table is for saving the users' information, the structure is as following |
uid |
Primary KEY, autoincrease |
username |
User's name |
password |
Password |
level |
The user's level, the default value is 0, if it is 1 then it is the administrator |
signDate |
Register time |
lastLogin |
The last login time |
"log" table is for chatting history, the structure as is as following |
lid |
Primary KEY, autoincrease |
target |
Massage receiving one |
ip |
The user's IP address |
username |
Massage sending one |
message |
Message content |
date |
Message sending time |
After running sql statement, insert two users in users table
username |
admin |
test |
password |
admin |
test |
level |
Administrator |
Register user |
3) Install amfphp program
Unzip phpService.zip, go into the amfphp_1.2 folder after unzipping, use Notepad or other text editor tools to open "services/flashchat/chatService.php", and modify the code.
Find the two lines of code as following:
// connect the data server
mysql_connect("localhost", "root","root");
// choose the database, if the name of your database is different, please change it
// to your database name.
mysql_select_db("flashchat");
Modify the database server address, database user's name and password, database name in mysql as your configuration respectively.
PHP interface detail usages, please refer to "PHP interface description"
4) Configure Flashchat
After finishing install chat program, log in chat as administrator, and then go to the administrator panel.

In the Setting panel, choose "remote database" in the red pane in the picture. In "Remoting gateway URL" textfield, fill the absolute url of gateway.php in amfphp_1.2 directory. And then fill the class path of server object in "Remoting class path" textfield, save the setting.
TOP
|