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


    简介:这是模拟OICQ的实现思路和核心程序的详细页面,介绍了和php,有关的知识、技巧、经验,和一些php源码等。

    class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=323427' scrolling='no'> 根据许多网友需求,特地把我站的这个模拟 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='images/face/".$onlineuser['Face'].".gif' width=20 height=20 ";
    if($name == $onlineuser['Name'])echo "border=1 ";
    echo " title='代号:".$onlineuser['Name']."\n昵称:".$onlineuser['NickName']."\n来访:".$onlineuser['EnterTimes']."'></a>";
    }
    ?>

    其中的 onClick 用于弹出发送消息的对话窗口,大家可以在网页的源代码里面看到

    “模拟OICQ的实现思路和核心程序”的更多相关文章 》

    爱J2EE关注Java迈克尔杰克逊视频站JSON在线工具

    http://biancheng.dnbcw.info/php/323427.html pageNo:16
  • 相关阅读:
    spring + junit 测试
    备份mysql数据库
    JAVA访问Zabbix API
    pro git 读书笔记 3 Git 分支
    pro git 读书笔记 1
    pro git 读书笔记 2
    溢出和剪裁,可见性
    html 与 jsp 文件格式区别
    Eclipse 的 CheckStyle 插件
    【转】单元测试覆盖率
  • 原文地址:https://www.cnblogs.com/ooooo/p/2255895.html
Copyright © 2020-2023  润新知