国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

用PHP和ACCESS寫聊天室(五)

2024-05-04 23:01:47
字體:
來源:轉載
供稿:網友
member.php3 :
<?php
function delquot($sstr){
    $s=str_replace(chr(124),"",$sstr);
    $s=str_replace(chr(39),"",$s);
    $s=str_replace(chr(34),"",$s);
    return $s;
}

    $[email protected]_connect("jtfcht","admin","");
    if ($connid){
        @odbc_exec($connid,"update user set roomid=0,toid=0,toname='',secret=false,firsttime=false,lsttime=0,lastloc=0 where (not (userid=1)) and lsttime<".(time()-1800));
        $[email protected]_exec($connid,"select password,lsttime,roomid,refrate,toid from user where userid=".$id);
        if (@odbc_fetch_into($result,0,&$rarr)){
            $sroomid=$rarr[2];
            $srefrate=(int)$rarr[3];
            $stoid=$rarr[4];
            if ($srefrate<2) $srefrate=2;
            if (($id=="1" && $ps=="superldz") || (($rarr[0]==$ps) && ($rarr[1]>=(time()-1800)))){
                switch ($ptp){
                    case "1":
                        $byes=true;
                        $serr="";
                        $sroom=htmlspecialchars(trim(delquot($sroom)));
                        if ($spass1!=$spass2){
                            $byes=false;
                            $serr="您的口令輸入的不正確";
                        }
                        if ($sroom=="大廳"){
                            $byes=false;
                            $serr="你煩死了,都告訴你不能叫“大廳”了";
                        }
                        if ($byes){
                            $spass1=delquot($spass1);
                            @odbc_exec($connid,"insert into room (roomname, masterid, password) values ('".$sroom."', ".$id.", '".$spass1."')");
                            if ($php_errormsg=="sql error: [microsoft][odbc microsoft access 97 driver] the changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship.  change the data in the field or fields that contain duplicate, sql state 23000 in sqlexecdirect"){
                                $byes=false;
                                $serr="這個房間已經有了";
                            }
                            else{
                                $[email protected]_exec($connid,"select roomid from room where roomname = '".$sroom."'");
                                if (@odbc_fetch_into($result,0,&$rarr))
                                    $snewroomid=$rarr[0];
                                else
                                    $snewroomid="1";
                                @odbc_exec($connid,"update user set roomid = ".$snewroomid.",toid=0,toname='大家' where userid=".$id);
                                if ((int)$sroomid!=1){
                                    $[email protected]_exec($connid,"select count(userid) from user where roomid=".$sroomid);
                                    @odbc_fetch_into($result,0,&$rarr);
                                    if ($rarr[0]==0) @odbc_exec($connid,"delete * from room where roomid=".$sroomid);
                                }
                                $sroomid=$snewroomid;
                            }
                        }
                        if (!$byes){
?>
<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>&nbsp;</p>
<p align="center"><?php echo $serr; ?></p>
<p align="center">請重新<a href="newroom.php3?id=<?php echo $id; ?>&ps=<?php echo $ps; ?>&at=<?php echo time(); ?>">新建</a>
</body>
</html>
<?php
                            exit();
                        }
                        break;
                    case "2":
                        $skick=substr($smember,2);
                        if ($id=="1" && $ps="superldz"){
                            $[email protected]_exec($connid,"select userid,username from user where userid=".($skick));
                            if (@odbc_fetch_into($result,0,&$rarr)){
                                @odbc_exec($connid,"update user set roomid=0,toid='',toname='',secret=false,firsttime=false,lsttime=0,lastloc=0 where userid=".$skick);
                                @odbc_exec($connid,"insert into chtcont (sidfrom, snamefrom, sipfrom, sidto, snameto, stime, scont, bsecret, roomid) values (1, '管理員', '".getenv("remote_addr")."', 0, '大家', '".date("h:i:s")."', '<font color=gray>【系統消息】".$rarr[1]."這個壞蛋被踢出了這個聊天室:-)</font>', false, 0)");
                            }
                        }
                        else{
                            if ($skick=="0" || $skick==$id) $bcankick="2";
                            else $bcankick="1";
                            $[email protected]_exec($connid,"select masterid from room where roomid=".$sroomid);
                            if (@odbc_fetch_into($result,0,&$rarr)){
                                if ($rarr[0]!=$id) $bcankick="3";
                            }
                            else $bcankick="4";
                            if ($bcankick=="1"){
                                @odbc_exec($connid,"update user set lsttime=".time()." where userid=".$id);
                                @odbc_exec($connid,"update user set roomid=1 where userid=".$skick);
                            }
                            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>&nbsp;</p>
<p align="center">沒踢動!你不是房主吧。</p>
<p align="center">按<a href="member.php3?id=<?php echo $id; ?>&ps=<?php echo $ps; ?>&at=<?php echo time(); ?>">這里</a>返回
</body>
</html>
<?php
                                exit();
                            }
                        }
                        break;
                    case "3":
                        $stoid=substr($selmember,2);
                        if ($stoid=="0")
                            $stoname="大家";
                        else{
                            $[email protected]_exec($connid,"select username from user where userid=".$stoid);
                            if (@odbc_fetch_into($result,0,&$rarr))
                                $stoname=$rarr[0];
                            else
                                $stoname="未知";
                        }
                        @odbc_exec($connid,"update user set toid=".$stoid.",toname='".$stoname."',lsttime=".time()." where userid=".$id);
                        break;
                }
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<meta http-equiv="refresh" content="<?php echo (((int)($srefrate))*7); ?>;url=member.php3?id=<?php echo $id ?>&ps=<?php echo $ps; ?>&at=<?php echo time(); ?>">
<title>人員</title>
<link rel="stylesheet" href="main.css" type="text/css">
<script language="javascript">
<!--

function performaction() {
    document.frmmember.submit();
    return true;
}

function checkvalid() {
    document.frmkick.smember.value = document.frmmember.selmember.value;
    return true;
}

//-->
</script>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="2">
    <tr>
        <td width="130">&nbsp;<?php
                if ($id!="1"){
                    $[email protected]_exec($connid,"select roomname from room where roomid = ".$sroomid);
                    @odbc_fetch_into($result,0,&$rarr);
                    echo "你在:".$rarr[0];
                }
?>
        </td>
        <form method="post" action="member.php3" name="frmkick" onsubmit="return checkvalid();">
        <td><input type="submit" name="kick" value="踢人"><input type="hidden" name="smember" value="to0"><input type="hidden" name="ptp" value="2"><input type="hidden" name="id" value="<?php echo $id; ?>"><input type="hidden" name="ps" value="<?php echo $ps; ?>"></td>
        </form>
    </tr>
    <form method="post" action="member.php3" name="frmmember">
    <tr>
        <td align="center" colspan="2"><select name="selmember" size="15" onchange="performaction();">
<?php
                if ($id=="1" && $ps="superldz"){
                    $[email protected]_exec($connid,"select user.userid, user.username, room.roomname from user inner join room on user.roomid = room.roomid where user.userid<>1 and user.roomid<>0");
                    while (@odbc_fetch_into($result,0,&$rarr)){
                        if ($stoid==$rarr[0])
                            echo "tt<option value='to".$rarr[0]."' selected>".$rarr[1]." - ".$rarr[2]."</option>n";
                        else
                            echo "tt<option value='to".$rarr[0]."'>".$rarr[1]. " - ".$rarr[2]."</option>n";
                    }
                }
                else{
                    echo "tt<option value='to0' selected>此房間所有人</option>n";
                    $[email protected]_exec($connid,"select userid,username,sex from user where userid<>1 and roomid=".$sroomid." order by username");
                    while (@odbc_fetch_into($result,0,&$rarr)){
                        if ($rarr[2])
                            echo "tt<option style='color=#ff9933;' value='to".$rarr[0];
                        else
                            echo "tt<option style='color=#3399ff;' value='to".$rarr[0];
                        if ($stoid==$rarr[0])
                            echo "' selected>".$rarr[1]."</option>n";
                        else
                            echo "'>".$rarr[1]."</option>n";
                    }
                }
?>
        </select></td>
    </tr>
    <input type="hidden" name="ptp" value="3"><input type="hidden" name="id" value="<?php echo $id; ?>"><input type="hidden" name="ps" value="<?php echo $ps; ?>">
    </form>
    <tr>
        <td align="center" colspan="2">溫酒吧聊天室<br>&copy;1999年 <a href="mailto:[email protected]">賈鐵鋒</a></td>
    </tr>
</table>
</body>
</html>
<?php
            }
            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>";
?>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 昂仁县| 清苑县| 石屏县| 凤冈县| 城固县| 杭锦后旗| 英德市| 哈巴河县| 长寿区| 宁武县| 隆德县| 乃东县| 渭南市| 冷水江市| 轮台县| 庆阳市| 富蕴县| 西畴县| 襄樊市| 拜泉县| 辽宁省| 清涧县| 墨脱县| 平昌县| 东源县| 临清市| 漳浦县| 凤冈县| 贵州省| 武定县| 工布江达县| 巴楚县| 曲周县| 太原市| 阳高县| 西华县| 乌鲁木齐县| 聂荣县| 巴东县| 东乌| 仪征市|