源码网,源码论坛,源码之家,商业源码,游戏源码下载,discuz插件,棋牌源码下载,精品源码论坛

 找回密码
 立即注册
查看: 233|回复: 9

[PHP编程] 用PHP和ACCESS写聊天室(九)

[复制链接]

7万

主题

861

回帖

32万

积分

论坛元老

Rank: 8Rank: 8

积分
329525
发表于 2006-10-9 00:00:00 | 显示全部楼层 |阅读模式
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> </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">
<link rel="stylesheet" href="main.css" type="text/css">
</head>
<body>
<p> </p>
<p align="center">这个房间已经被拆了!</p>
<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 echo "<html><head><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><title>房间</title><link rel='stylesheet' href='main.css' type='text/css'></head><body></body></html>";
                }
                else echo "<html><head><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><title>房间</title><link rel='stylesheet' href='main.css' type='text/css'></head><body></body></html>";
                @odbc_close($ConnID);
        }
        else echo "<html><head><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><title>房间</title><link rel='stylesheet' href='main.css' type='text/css'></head><body></body></html>";
        include("room.php3");
?>



【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】    
回复

使用道具 举报

9

主题

1万

回帖

420

积分

中级会员

Rank: 3Rank: 3

积分
420
发表于 2023-1-8 14:17:32 | 显示全部楼层
谢谢分享,先下来用用
回复 支持 反对

使用道具 举报

0

主题

1万

回帖

0

积分

中级会员

Rank: 3Rank: 3

积分
0
发表于 2023-3-7 19:19:18 | 显示全部楼层
好东西一定要看看!
回复 支持 反对

使用道具 举报

1

主题

1万

回帖

307

积分

中级会员

Rank: 3Rank: 3

积分
307
发表于 2024-4-11 18:21:08 | 显示全部楼层
8888888888888888
回复 支持 反对

使用道具 举报

2

主题

1万

回帖

69

积分

注册会员

Rank: 2

积分
69
发表于 2024-6-27 03:53:54 | 显示全部楼层
看看看看看看看看看看看看看看看看看看看看看看看看看看看
回复 支持 反对

使用道具 举报

2

主题

1万

回帖

473

积分

中级会员

Rank: 3Rank: 3

积分
473
发表于 2024-9-1 07:45:37 | 显示全部楼层
看到这帖子真是高兴!
回复 支持 反对

使用道具 举报

2

主题

1万

回帖

381

积分

中级会员

Rank: 3Rank: 3

积分
381
发表于 2024-9-9 00:55:55 | 显示全部楼层
哈哈哈哈哈哈
回复 支持 反对

使用道具 举报

0

主题

1万

回帖

0

积分

中级会员

Rank: 3Rank: 3

积分
0
发表于 2024-9-12 19:47:47 | 显示全部楼层
还可以不错
回复 支持 反对

使用道具 举报

0

主题

1万

回帖

0

积分

中级会员

Rank: 3Rank: 3

积分
0
发表于 5 天前 | 显示全部楼层
很好,谢谢分享
回复 支持 反对

使用道具 举报

7

主题

1万

回帖

288

积分

中级会员

Rank: 3Rank: 3

积分
288
发表于 前天 22:01 | 显示全部楼层
飞飞飞飞飞飞飞飞飞飞飞飞飞
回复 支持 反对

使用道具 举报

高级模式
B Color Image Link Quote Code Smilies

本版积分规则

手机版|小黑屋|网站地图|源码论坛 ( 海外版 )

GMT+8, 2024-9-20 21:28 , Processed in 0.118245 second(s), 26 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表