Simulation of OICQ implementation ideas and core programs (1)
Source: Internet
Author: User
Based on the needs of many netizens, I have dedicated my online chat on this simulated OICQ! 1. you must register for login. you do not need to ask if you save the following field names in the database userinfo. this is the username used for login. you must use the unique Password to log on to the NickName user NickName, that is, the displayed SyntaxHighlighter. 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,
Prima (the most complete virtual host Management System) ry 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 (the best combination with PHP) _ query ("select Name, NickName, Face, EnterTimes from userinfo where OnlineStatus = 1 and CurrentDate> ". (date ("U")-120 ));
$ Onlinenumber = MySQL (the best combination with PHP) _ 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 (the best combination with PHP) _ fetch_array ($ onlineresult) break;
Echo "(as the mainstream development language )? Talkto = ". $ onlineuser [Name]. ",". $ onlineuser [Name]. ", width = 300, height = 250)> if ($ name = $ onlineuser [Name]) echo" border = 1 ";
Echo "title = code:". $ onlineuser [Name]. "NickName:". $ onlineuser [NickName]. "access:". $ onlineuser [EnterTimes]. "> ";
}
?>
OnClick is used to pop up the dialog window for sending messages. you can see it in the source code of the webpage.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service