The realization idea and core procedure of simulating OICQ (a) turn--suggest to join the essence area

Source: Internet
Author: User
Tags date join
Program | Essence article Source: PHP century Net
According to the needs of many netizens, specially put my station this analog OICQ online chat things to everyone!

1 users must register to login, in the database UserInfo to save the following several fields
Name does not need to ask, this is the login username, must be unique
Password Login Password
Nickname user Nickname, which is the name displayed
Face holds the number of the user avatar, such as 01, representing the/images/face/01.gif avatar file
Onlinestatus user's online logo, set to 1 when the user logs in
currentdate user's last access/update time to determine whether the user is online

Chat record Forumtalk's structure is
CREATE TABLE Forumtalk (
ID Int (one) not NULL auto_increment,
Sender varchar is not NULL,
Receiver varchar is not NULL,
Date int (one) DEFAULT ' 0 ' not NULL,
Readsign tinyint (4) DEFAULT ' 0 ' not NULL,
Body varchar is not NULL,
PRIMARY KEY (ID),
UNIQUE id_2 (ID),
KEY ID (ID)
);
Where sender is the sender's Name
Receiver is the Name of the receiving person
Date is the time to speak
Readsign Have you read the speech
Body Speech content

2 displaying 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, there are:". $onlinenumber. " A friend online, according to the Avatar send Short message: ";
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 Visit: "$onlineuser [' entertimes ']." ></a> ";
}
?>

The OnClick is used to eject the conversation window that sends the message, you can see in the source code of the webpage


Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.