Introduction: This is the implementation idea and core of simulating OICQ.ProgramThe details page of PHP, related knowledge, skills, experience, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 323427 'rolling = 'no'>
Based on the needs of many netizens, I have dedicated my online chat on this simulated OICQ!
1. the user must register for login and save the following fields in the database userinfo:
No need to ask, This is the login user name, must be unique
Password Login Password
Nickname: the nickname of the user, that is, the name displayed.
Face stores the user avatar number, such as 01, representing/images/face/01.gif Avatar File
Onlinestatus indicates whether the user is online. It is set to 1 when the user logs in.
Currentdate the last time the user accesses/updates, used to determine whether the user is online
The structure of the chat record forumtalk is
Create Table forumtalk (
Id int (11) not null auto_increment,
Sender varchar (20) not null,
Receiver varchar (20) not null,
Date int (11) default '0' not null,
Readsign tinyint (4) default '0' not null,
Body varchar (200) not null,
Primary Key (ID ),
Unique id_2 (ID ),
Key ID (ID)
);
The sender is the sender's name.
The receiver is the receiver's name.
Date is the time of the speech
Have you read readsign?
Body speech content
2. display the avatar of an online user
<?
$ Onlineresult = mysql_query ("Select name, nickname, face, entertimes from userinfo where onlinestatus = 1 and currentdate>". (date ("U")-120 ));
$ Onlinenumber = mysql_num_rows ($ onlineresult );
Echo "Welcome, a total of:". $ onlinenumber. "A friend online, send a short message according to the Avatar :";
For ($ I = 0; $ I <$ onlinenumber; $ I)
{
If (! $ Onlineuser = mysql_fetch_array ($ onlineresult) break;
Echo "<a onclick = mm_openbrwindow ('shortalk. php? Talkto = ". $ onlineuser ['name']. "','". $ onlineuser ['name']. "', 'width = 300, Height = 250')> If ($ name = $ onlineuser ['name']) echo "border = 1 ";
Echo "Title = 'Code :". $ onlineuser ['name']. "\ n nickname :". $ onlineuser ['nickname']. "\ n Access :". $ onlineuser ['entertimes']. "'> </a> ";
}
?>
Onclick is used to pop up the dialog window for sending messages.Source codeSee
More articles on "simulating OICQ Implementation ideas and Core Programs"
Love J2EE follow Java Michael Jackson video station JSON online tools
Http://biancheng.dnbcw.info/php/323427.html pageno: 16.