您现在的位置: 无忧电子商务网 >> 信息学院 >> 程序开发 >> php >> 正文

模拟OICQ的实现思路和核心程序

作者:佚名    信息学院来源:整理    点击数:    更新时间:2008-2-2 我要参与讨论

 


根据许多网友需求,特地把我站的这个模拟 oicq 的在线聊天的东西献给大家!

1 用户必须注册登陆,在数据库 userinfo 里面保存如下几个字段
name 不用问了,这是登陆用的用户名,必须唯一
password 登陆密码
nickname 用户昵称,也就是显示的名字
face 存放着用户头像的编号,比如 01,代表 /images/face/01.gif 头像文件
onlinestatus 用户是否在线的标志,在用户登陆的时候设置为 1
currentdate 用户最后访问/更新的时间,用于判断用户是否在线

聊天纪录 forumtalk 的结构为
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)
);
其中 sender 是发送人的 name
receiver 是接受人的 name
date 是发言的时间
readsign 发言是否已经阅读过
body 发言内容

2 显示在线用户的头像
<?
$onlineresult = mysql_query("select name,nickname,face,entertimes from userinfo where onlinestatus=1 and currentdate >".(date("u")-120));
$onlinenumber = mysql_num_rows($onlineresult);
echo "欢迎光临,共有:".$onlinenumber."位朋友在线,按头像发短信息:";
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')><img src='http://www.dvbbs.net/tech/php/images/face/".$onlineuser['face'].".gif' width=20 height=20 ";
if($name == $onlineuser['name'])echo "border=1 ";
echo

[1] [2] [3] [4] [5] [6] 下一页

在google里搜索更多模拟OICQ的实现思路和核心程序

Google
Web www.51ec.org
【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
我来说两句 对此文章发表了评论
  昵 称: *必填    ·注册用户·
  评 分: 1分 2分 3分 4分 5分     严禁发表危害国家安全、政治、黄色淫秽等内容的评论,用户需对自己在使用本网站服务过程中的行为承担法律责任。本站管理员有权保留或删除评论内容,评论内容只代表机友个人观点,与本网站立场无关。  
评 论
内 容

 
评论列表 (最新 评论仅限网友观点!)

供求信息




| 设为首页 | 加入收藏 | 关于我们 | 广告服务 | 联系方式 | 友情链接 | 版权申明