脚本宝典收集整理的这篇文章主要介绍了用PHP和ACCESS写聊天室(九),脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
enterrm.
PHP3
代码如下:
<?
PHP &nbs
p; $ConnID=@odbc_connect("jt
fcht","admin","");
if ($ConnID){
$result=@odbc_exec($ConnID,"SELECT PassWord,LstTime,RoomID,RefRate
From User WHERE UserID=".$id);
if (@odbc_fetch_into($result,&$rArr)){
$sRoomID=$rArr[2];
$sRefRate=(int)$rArr[3];
if ($sRefRate<2) $sRefRate=2;
if (($rArr[0]
==$ps) && ($rArr[1]>=(time()-1800))){
$sNewRoomID=s
ubstr($selRoom,2);
if ($sNewRoomID!=$sRoomID){
$result=@odbc_exec($ConnID,"SELECT Password F
rom Room WHERE RoomID=".$sNewRoomID);
if (@odbc_fetch_into($result,&$rArr)){
if ((
strlen(trim($rArr[0]))==0) || ($rArr[0]==$sPass)){
@odbc_exec($ConnID,"UPDATE User SET RoomID=".$sNewRoomID.",ToID=0,ToN
ame='大家' WHERE UserID=".$id);
if ((int)$sRoomID!=1){
$result=@odbc_exec($ConnID,"SELECT COUNT(UserID) FROM User WHERE RoomID=".$sRoomID);
@odbc_fetch_into($result,&$rArr);
if ($rArr[0]==0) @odbc_exec($ConnID,"DELETE * FROM Room Where RoomID=".$sRoomID);
}
}
else{
?>
<ht
ML>
<head>
<t
ITle>输入房间口令</title>
<
Meta http-equiv="Content
-ty
PE" 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");
?>
【本文版权归作者与奥索网共同拥有,如需
转载,请注明作者及出处】
脚本宝典总结
以上是脚本宝典为你收集整理的用PHP和ACCESS写聊天室(九)全部内容,希望文章能够帮你解决用PHP和ACCESS写聊天室(九)所遇到的问题。
如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。