Write chat rooms with PHP and access (iv)

Source: Internet
Author: User
The code is as follows:
<?php
$ConnID = @odbc_connect ("Jtfcht", "admin", "");
if ($ConnID) {
@odbc_exec ($ConnID, "DELETE * from Room WHERE (Roomid is (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";
}
}
?>


<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>

<body>
<table width= "100%" border= "0" align= "center" cellpadding= "0" cellspacing= "2" >
<tr>
&LT;TD colspan= "3" > <font style= "FONT-SIZE:10.5PT;" > Existing Rooms:</font></td>
</tr>
<form method= "POST" action= "#" Name= "Frmroom" >
<tr>
&LT;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") {
?>
&LT;TD width= "align=" "Center" ></td>
&LT;TD width= "align=" center ></td>
<?php
}
else{
?>
<form method= "POST" action= "Newroom.php3" name= "Frmnewroom" target= "Member" >
&LT;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" >
&LT;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" >
&LT;TD align= "center" ><input type= "Submit" Name= "Delroom" value= "Demolition Room" ><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>

<?php
}
else echo "}
else echo "@odbc_close ($ConnID);
}
else echo "?>


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.