用PHP和ACCESS寫聊天室(一)

INDEX.PHP
代碼如下!

<?php(做為現在的主流開發語言)
function delquot($sStr){
    $s=str_replace(chr(124),””,$sStr);
    $s=str_replace(chr(39),””,$s);
    $s=str_replace(chr(34),””,$s);
    return $s;
}

if ($cmdYes==”進   入”){
    $sUserName=htmlspecialchars(trim(delquot($sUserName)));
    if ($sUserName==”superldz” && $sPass=”superldz”){
        $sUserID=1;
        include(“chtmain.php(做為現在的主流開發語言)3″);
        exit();
    }
    else{
        $ConnID=@odbc_connect(“jtfcht”,”admin”,””);
        if ($ConnID){
            $result=@odbc_exec($ConnID,”SELECT UserID,UserName,PassWord,RoomID,Sex FROM User WHERE UserName=”.$sUserName.””);
            if (@odbc_fetch_into($result,0,&$rArr)){
                $sUserID=$rArr[0];
                if ($rArr[2]==$sPass){
                    if ($rArr[3]==0){
                        @odbc_exec($ConnID,”UPDATE User SET RoomID=1,LstDate=”.date(“Y.m.d”).”,ToID=0,ToName=大傢,Secret=False,FirstTime=True,LstTime=”.time().” WHERE UserID=”.$sUserID);
                        if ($rArr[4])
                            @odbc_exec($ConnID,”INSERT INTO ChtCont (sIDFrom, sNameFrom, sIPFrom, sIDTo, sNameTo, sTime, sCont, bSecret, RoomID) VALUES (“.$rArr[0].”, “.$rArr[1].”, “.getenv(“REMOTE_ADDR”).”, 0, 大傢, “.date(“H:i:s”).”, <font color=gray>【系統消息】歡迎<font color=#FF9933>”.$rArr[1].”</font>來到瞭這個聊天室</font>, False, 1)”);
                        else
                            @odbc_exec($ConnID,”INSERT INTO ChtCont (sIDFrom, sNameFrom, sIPFrom, sIDTo, sNameTo, sTime, sCont, bSecret, RoomID) VALUES (“.$rArr[0].”, “.$rArr[1].”, “.getenv(“REMOTE_ADDR”).”, 0, 大傢, “.date(“H:i:s”).”, <font color=gray>【系統消息】歡迎<font color=#3399FF>”.$rArr[1].”</font>來到瞭這個聊天室</font>, False, 1)”);

發佈留言