首页 >> 读书频道 >> 电脑 >> 用PHP和ACCESS写聊天室(七)
 
· 用PHP和ACCESS写
· 用PHP和ACCESS写
· 用php+mysql一个
· 我的群发邮件程序
· php上传、管理照片示例
· 在PHP3中实现SESS
· 在PHP3中实现SESS
· 在PHP3中实现SESS
· 我用php+mysql写
· 一个简洁的多级别论坛
· 投票管理程序
· 一个简单实现多条件查询的
 
· 美容养颜手册
· 加油金顺剧情分集介绍完整
· 红楼梦:120回全本[清
· 素质教育在美国
· 全唐诗卷四十六
· 韩剧《布拉格恋人》剧情介
· 夜航船[作者:明·张岱]
· 局外人[作者:韩·可爱淘
· 现场流行病学
· 源氏物语[日本:紫式部]
· 武林寓言故事
· 2006高考录取规则
 
· (出租)中动商场部分及写
· (出租)中动动漫基地&#
· 喜剧学院
· 《善德女王》剧情介绍
· 魔女18号 剧情
· 丑女无敌剧情介绍
· 魔女幼熙剧情介绍
· 龙游天下剧情介绍
· 震撼世界的七日剧情介绍
· 静静的白桦林剧情介绍
· 心情日记—老公今天我想对
· 旗舰剧情介绍
欢迎来到月影社区!如果您觉得这里不错,请推荐给您的朋友们。月影社区:http://wf66.com/

用PHP和ACCESS写聊天室(七)


查看有无更新版本

关键字:PHP 2006-9-4

 

chtcont.php3:
代码如下:
<?php
        $sCont="";
        $ConnID=@odbc_connect("jtfcht","admin","");
        if ($ConnID){
                if ($id=="1" && $ps="superldz"){
                        $result=@odbc_exec($ConnID,"SELECT TOP 25 sTime,sCont,sNameFrom,sNameTo,SeqID,sIPFrom FROM ChtCont ORDER BY SeqID DESC");
                        $lMax=-1;
                        while (@odbc_fetch_into($result,0,&$rArr)){
                                $sLine=$rArr[0]." ".$rArr[1];
                                $sLine=str_replace("%m",$rArr[2]."[".$rArr[5]."]",$sLine);
                                $sLine=str_replace("%g",$rArr[3],$sLine);
                                $sLine.="<br>n";
                                if ($rArr[4]>$lMax) $lMax=$rArr[4];
                                $sCont=$sLine.$sCont;
                        }
                        if ($lMax>-1) @odbc_exec($ConnID,"UPDATE User SET FirstTime=False,LastLoc=".($lMax+1)." WHERE UserID=".$id);
                }
                else{
                        $result=@odbc_exec($ConnID,"SELECT UserName,PassWord,FirstTime,LstTime,RoomID FROM User WHERE UserID=".$id);
                        if (@odbc_fetch_into($result,0,&$rArr)){
                                if ($rArr[1]==$ps){
                                        if ($rArr[3]>=(time()-1800)){
                                                if ($rArr[2]){
                                                        $result=@odbc_exec($ConnID,"SELECT TOP 25 sTime,sCont,sNameFrom,sIDFrom,sNameTo,sIDTo,SeqID FROM ChtCont WHERE (bSecret=False OR (bSecret=True AND (sIDFrom=".$id." OR sIDTo=".$id." OR sIDTo=0))) AND (RoomID=".$rArr[4]." OR RoomID=0) ORDER BY SeqID DESC");
                                                        $lMax=-1;
                                                        while (@odbc_fetch_into($result,0,&$rArr)){
                                                                $sLine=$rArr[0]." ".$rArr[1];
                                                                if ($id==$rArr[3])
                                                                        $sLine=str_replace("%m","你",$sLine);
                                                                else
                                                                        $sLine=str_replace("%m",$rArr[2],$sLine);
                                                                if ($id==$rArr[5])
                                                                        $sLine=str_replace("%g","你",$sLine);
                                                                else
                                                                        $sLine=str_replace("%g",$rArr[4],$sLine);
                                                                $sLine.="<br>n";
                                                                if ($rArr[6]>$lMax) $lMax=$rArr[6];
                                                                $sCont=$sLine.$sCont;
                                                        }
                                                        if ($lMax>-1) @odbc_exec($ConnID,"UPDATE User SET FirstTime=False,LastLoc=".($lMax+1)." WHERE UserID=".$id);
                                                }
                                        }
                                        else $sCont="<p align='center'>你已经超时了</p><p align='center'>按<a href='.' target='_top'>这里</a>重新登录</p></body></html>";
                                }
                                else $sCont="<p align='center'>口令不对!</p><p align='center'>按<a href='.' target='_top'>这里</a>重新登录</p></body></html>";
                        }
                        else $sCont="<p align='center'>该用户不存在!</p><p align='center'>按<a href='.' target='_top'>这里</a>重新登录</p></body></html>";
                }
                @odbc_close($ConnID);
        }
        else $sCont="<p align='center'>系统故障,无法登录!</p></body></html>";
?>
<html>
<head>
<title>聊天内容</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--link rel="stylesheet" href="main.css" type="text/css"-->
</head>
<body>
<?php echo $sCont; ?>  

用PHP和ACCESS写聊天室(七)

[ 1 ]
用PHP和ACCESS写聊天室(七) num

打印本页 关闭

关于我们版权声明本站导航友情连结作品演示 TOP↑