Database Integration -- PHP Interface Description

There is PHP reserved interface. Through this, you can save the chat users' information and chat history into your database on the website. And you also can check the user's identity through the interface.
Flash Remoting technology which is based on open source library AMFPHP is used for PHP interface. The following is the usage description:
1) Server Environment
Php (php4,php5) + mysql
Remoting gateway interface program: Amfphp 1.2
2) Server-side program
Remoting program file exists as class file, and it is placed in "Service" folder of amfphp directory. Class file can be put directly in service directory, or it is can be put in the individual folder in Service directory.
When Flash client invoke the method of the program object on the server, the class path must be appointed completely. For example, class file "Helloword" is saved in "service" directory, the path is "Helloworld", if class file "Helloworld" is in the "test" directory of "service" directory, its class path changes to "test.Helloworld".
3) Server program syntax
The class files must include by the following 3 methods, the name of method and parameters style must be the same as the following description, or the program can't work properly.
/*
* used for login and identifying
*
* @ param $username: User's name login
* @ param $pass: password, if login as a guest, don't fill in the blank
* @ param $isRegister: whether the user is new, if he/she is, it is true, or it is a
* blank or false
*/
function doLogin($username,$pass = null,$isRegister = false){
/*
Please put your code here to database connection processing
*/
return Null/"guest"/"member"/"admin"
}
doLogin Function must have return value for Red5/FMS to receive, there are four kinds of return value
- Null: Null, login failed
- "guest": String, login succeed and login as a guest
- "member": String, login succeed and login as a register user
- "admin": String, login succeed and login as an administrator who has the highest purview.
Explanation: doLogin function is the most important, if it is wrong then nobody can login. So please check it very carefully before you modify.
/*
* change the password, only for the register users
*
* @ param $username: User's login name
* @ param $oldPass: old pass word
* @ param $newPass: new pass word
*/
function modifyPassword($username,$oldPass,$newPass){
/*
Please put your code for checking your old password and setting your new password here
*/
return true/false;
}
"modifyPassword" function must have return value and it is true of false which is for showing whether the action is completed.
/*
*
save the chat history
*
* @ param $target: Receiving massage one's name, if the one is in the
* chatting room then it is the room's name. If it is a private chat, it is the user's
*
name.
* @ param $ip: The user's IP address
* @ param $username: Sending message user's name
* @ param $message: Massage content
*/
function saveChatLog($target,$ip,$username,$message){
/*
Please put the code for saving the chat record into the database.
*/
}
The function doesn't need the return value.
Explanation: only the administrator enables the function of saving chatting history in the control panel at the background, the function works.
TOP
|