代码如下: <?php $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"; } } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>房间</title> <link rel="stylesheet" href="main.CSS" type="text/css"> <meta http-equiv="refresh" content="<?php echo (((int)($sRefRate))*8); ?>;url=room.php3?id=<?php echo $id ?>&ps=<?php echo $ps; ?>&at=<?php echo time(); ?>"> <script language="javaScript"> <!--
function CheckValid() { document.frmInRoom.selRoom.value = document.frmRoom.selRoom.value; return true; }
function AlertIt() { document.frmDelRoom.sDelRoom.value = document.frmRoom.selRoom.value; return confirm("你真的要拆了这个房子啊!"); }