欢迎来到福编程网,本站提供各种互联网专业知识!

用PHP和ACCESS写聊天室(四)

发布时间:2006-10-09 作者: 来源:转载
代码如下:房间
代码如下:

$ConnID=@odbc_connect("jtfcht","admin","");

if ($ConnID){

@odbc_exec($ConnID,"DELETE * FROM Room WHERE (RoomID Not IN (SELECT DISTINCT RoomID FROM User)) AND RoomID<>1");

$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 (($id=="1" && $ps=="superldz") || (($rArr[0]==$ps) && ($rArr[1]>=(time()-1800)))){

if ($bPost=="1"){

$sDelRoom=substr($sDelRoom,2);

if ($sDelRoom=="1") $bCanDel=false;

else $bCanDel=true;

if ($id!="1" && $ps="superldz"){

$result=@odbc_exec($ConnID,"SELECT MasterID FROM Room WHERE RoomID=".$sDelRoom);

if (@odbc_fetch_into($result,0,&$rArr)){

if ($rArr[0]!=$id) $bCanDel=false;

}

else $bCanDel=false;

}

if ($bCanDel){

@odbc_exec($ConnID,"UPDATE User SET LstTime=".time()." WHERE RoomID=".$sDelRoom." AND UserID=".$id);

@odbc_exec($ConnID,"UPDATE User SET RoomID=1 WHERE RoomID=".$sDelRoom);

@odbc_exec($ConnID,"DELETE * FROM Room WHERE RoomID=".$sDelRoom);

$sRoomID="1";

}

}

?>

房间

if ($id=="1" && $ps="superldz"){

?>

}

else{

?>

}

?>

已有的房间:

echo "<select name='selRoom' size='7' style='WIDTH: 160px'>n";

$result=@odbc_exec($ConnID,"SELECT RoomID,RoomName FROM Room ORDER BY RoomID");

while (@odbc_fetch_into($result,0,&$rArr)){

if ((int)($sRoomID)==$rArr[0])

echo "ttttn";

else

echo "ttttn";

}

echo "ttttn";

?>

}

else echo "房间";

}

else echo "房间";

@odbc_close($ConnID);

}

else echo "房间";

?>

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

相关推荐