您现在的位置: 军旅同心-旅游自驾-军旅文学 >> 读书赏析 >> 学习园地 >> 电脑网络 >> 技术文章 >> 正文
用PHP和ACCESS写聊天室(九)
作者:采集员 文章来源:来源于网络 点击数: 更新时间:2005-9-10 14:36:21
enterrm.php3
代码如下:
<?php
        $ConnID=@odbc_connect("jtfcht","admin","");
        if ($ConnID){
                $result=@odbc_exec($ConnID,"SELECT PassWord,LstTime,RoomID,RefRate FROM User WHERE UserID=".$id);
                if (@odbc_fetch_into($result,0,&$rArr)){
                        $sRoomID=$rArr[2];
                        $sRefRate=(int)$rArr[3];
                        if ($sRefRate<2) $sRefRate=2;
                        if (($rArr[0]==$ps) && ($rArr[1]>=(time()-1800))){
                                $sNewRoomID=substr($selRoom,2);
                                if ($sNewRoomID!=$sRoomID){
                                        $result=@odbc_exec($ConnID,"SELECT Password FROM Room WHERE RoomID=".$sNewRoomID);
                                        if (@odbc_fetch_into($result,0,&$rArr)){
                                                if ((strlen(trim($rArr[0]))==0) || ($rArr[0]==$sPass)){
                                                        @odbc_exec($ConnID,"UPDATE User SET RoomID=".$sNewRoomID.",ToID=0,ToName='大家' WHERE UserID=".$id);
                                                        if ((int)$sRoomID!=1){
                                                                $result=@odbc_exec($ConnID,"SELECT COUNT(UserID) FROM User WHERE RoomID=".$sRoomID);
                                                                @odbc_fetch_into($result,0,&$rArr);
                                                                if ($rArr[0]==0) @odbc_exec($ConnID,"DELETE * FROM Room Where RoomID=".$sRoomID);
                                                        }
                                                }
                                                else{
?>
<html>
<head>
<title>输入房间口令</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="main.css" type="text/css">
<script language="JavaScript">
<!--

function PassSetFocus( ) {
        document.frmEnterSm.sPass.focus();
}

//-->
</script>
<link rel="stylesheet" href="main.css" type="text/css">
</head>
<body onload="PassSetFocus();">
<p>&nbsp;</p>
<p align="center"><font color="#996666">输入房间口令</font></p>
<form name="frmEnterSm" action="enterrm.php3" method="post">
<table width="100%" border="0" align="center">
        <tr>
                <td colspan="2"><input type="hidden" name="selRoom" value="<?php echo $selRoom; ?>"><input type="hidden" name="id" value="<?php echo $id; ?>"><input type="hidden" name="ps" value="<?php echo $ps; ?>"></td>
        </tr>
        <tr>
                <td width="40%" align="right">口令:</td>
                <td width="60%"><input type="password" name="sPass" maxlength="10" size="8"></td>
        </tr>
        <tr>
                <td colspan="2" align="center"><input type="submit" name="cmdYes" value="进入"></td>
        </tr>
</table>
</form>
<p align="center">按<a href="room.php3?id=<?php echo $id; ?>&ps=<?php echo $ps; ?>&at=<?php echo time(); ?>">这里</a>放弃</p>
</body>
</html>
<?php
                                                        exit();
                                                }
                                        }
                                        else{
?>
<html>
<head>
<title>加入房间出错</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<

[1] [2] 下一页


更多
免责声明:作品版权归所属媒体与作者所有!!本站刊载此文不代表同意其说法或描述,仅为提供更多信息。如果您认为我们侵犯了您的版权,请告知!本站立即删除。有异议请联系我们。
文章录入:烟灰缸    责任编辑:烟灰缸 
网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
| 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 网站地图 | 版权申明 | 网站公告 | 管理登录 |