打印本文 打印本文  关闭窗口 关闭窗口
用PHP和ACCESS写聊天室(六)
作者:采集员 文章来源:来源于网络 点击数: 更新时间:2005/9/10 14:36:22
leave.php3 :
<?php
    $ConnID=@odbc_connect("jtfcht","admin","");
    if ($ConnID){
        if (!($id=="1" && $ps="superldz")){
            $result=@odbc_exec($ConnID,"SELECT UserName,PassWord,RoomID,Sex FROM User WHERE UserID=".$id);
            if (@odbc_fetch_into($result,0,&$rArr)){
                if ($rArr[1]==$ps)
                    if ($rArr[3])
                        @odbc_exec($ConnID,"INSERT INTO ChtCont (sIDFrom, sNameFrom, sIPFrom, sIDTo, sNameTo, sTime, sCont, bSecret, RoomID) VALUES (".$id.", '".$rArr[0]."', '".getenv("REMOTE_ADDR")."', 0, '大家', '".date("H:i:s")."', '<font color=gray>【系统消息】<font color=#FF9933>".$rArr[0]."</font>离开了这个聊天室</font>', False, ".$rArr[2].")");
                    else
                        @odbc_exec($ConnID,"INSERT INTO ChtCont (sIDFrom, sNameFrom, sIPFrom, sIDTo, sNameTo, sTime, sCont, bSecret, RoomID) VALUES (".$id.", '".$rArr[0]."', '".getenv("REMOTE_ADDR")."', 0, '大家', '".date("H:i:s")."', '<font color=gray>【系统消息】<font color=#3399FF>".$rArr[0]."</font>离开了这个聊天室</font>', False, ".$rArr[2].")");
            }
            @odbc_exec($ConnID,"UPDATE User SET RoomID=0,ToID=0,ToName=',Secret=False,FirstTime=False,LstTime=0,LastLoc=0 WHERE UserID=".$id);
        }
        @odbc_close($ConnID);
    }
    header("Location: .");
?>



打印本文 打印本文  关闭窗口 关闭窗口