The Code is as follows:
<? 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> Room </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 ("You Really Want To demolish this house! ");
}
// -->
</Script>
</Head>
<Body>
<Table width = "100%" border = "0" align = "center" cellpadding = "0" cellspacing = "2">
<Tr>
<Td colspan = "3"> <font style = "font-size: 10.5pt;"> existing rooms: </font> </td>
</Tr>
<Form method = "post" action = "#" name = "frmRoom">
<Tr>
<Td align = "center" colspan = "3"> <? Php
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 "tttt <option value = 'rm". $ rArr [0]. "'selected>". $ rArr [1]. "</option> n ";
Else
Echo "tttt <option value = 'rm". $ rArr [0]. "'>". $ rArr [1]. "</option> n ";
}
Echo "tttt </select> n ";
?>
</Td>
</Tr>
</Form>
<Tr>
<? Php
If ($ id = "1" & $ ps = "superldz "){
?>
<Td width = "64" align = "center"> </td>
<Td width = "50" align = "center"> </td>
<? Php
}
Else {
?>
<Form method = "post" action = "newroom. php3" name = "frmNewRoom" target = "member">
<Td align = "center"> <input type = "submit" name = "newroom" value = "new"> <input type = "hidden" name = "id" value = "<? Php echo $ id;?> "> <Input type =" hidden "name =" ps "value =" <? Php echo $ ps;?> "> </Td>
</Form>
<Form method = "post" action = "enterrm. php3" name = "frmInRoom" onsubmit = "return CheckValid ();">
<Td align = "center"> <input type = "submit" name = "cmdEnter" value = "add"> <input type = "hidden" name = "selRoom" value = "1"> <input type = "hidden" name = "sPass" value = ""> <input type = "hidden" name = "id" value = "<? Php echo $ id;?> "> <Input type =" hidden "name =" ps "value =" <? Php echo $ ps;?> "> </Td>
</Form>
<? Php
}
?>
<Form method = "post" action = "room. php3" name = "frmDelRoom" onsubmit = "return AlertIt ();">
<Td align = "center"> <input type = "submit" name = "delroom" value = "split"> <input type = "hidden" name = "sDelRoom" value = "1"> <input type = "hidden" name = "bPost" value = "1"> <input type = "hidden" name = "id" value = "<? Php echo $ id;?> "> <Input type =" hidden "name =" ps "value =" <? Php echo $ ps;?> "> </Td>
</Form>
</Tr>
</Table>
</Body>
</Html>
<? Php
}
Else echo "}
Else echo "@ Odbc_close ($ ConnID );
}
Else echo "?>
[This article is copyrighted by the author and osuo. If you need to reprint it, please indicate the author and its source]