Using PHP and ACCESS to write a chat room (1)_PHP tutorial

WBOY
Release: 2016-07-21 16:02:34
Original
881 people have browsed it

INDEX.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.php3");
        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")."', '【系统消息】欢迎".$rArr[1]."来到了这个聊天室', 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")."', '【系统消息】欢迎".$rArr[1]."来到了这个聊天室', False, 1)");
                        include("chtmain.php3");
                        exit();
                    }
                    else $sErrText="登录出错,已经有人用这个名字登录了!";
                }
                else $sErrText="登录出错,口令不正确!“; ";
                 @odbc_close($ConnID); }
}
?>



Warm Bar Chat Room




 



    
        
        
    
    
        
            
        
Cht
            
            

本页永久域名:http://jtf.126.com/
        


        
            
                                                                                                                %">
                                                                        
  • Display the room list on the right side , the following is the list of guests in the room you are in

  •                                                                                    
  • You can specify the other party to speak< /li>
                                                                                         < Destroy the room and kick the people in this room to the hall
    🎜>                                                                                                                        >                                                                                                                                            < ;/li>
                                                                                        ;/ul>
                                    
  • 命令行中进行了过滤,不允许出现 HTML TAG

  •                             
                                
                            
                            
                                
                            
                        

                        

                            
                                
                            
    if ($cmdYes=="进 入"){
    ?>
                            
                                
                            
                            
                                
                            
    }
    ?>
                        



                        

                            
                            
                                
                            
                            
                                
                                
                                
                            
                            
                                
                                
                                
                            
                            
                                
                            
                            
                        
    在此登录
    昵称:  
    口令:
    点击这里注册新用户

                                                      <                                                               3">
     


                    

            
        
        
    <script> <br>document.write("<a href="http://view.gznet.com/cgi-bin/rl_views.cgi?UID=10031505" target=sxrl>");  <br>document.write("<img src="http://refer.gznet.com/cgi-bin/rl_refer2.cgi?UID=10031505&refer="+escape(top.document.referrer)+"" width=88 height=31 border=0 alt="飞华统计专家">");  <br>document.write("</a>");  <br>document.write("<a href=http://best.netease.com/cgi-bin/view/viewbasic.cgi?jtfcht target=_blank><img src=http://best.netease.com/cgi-bin/log.cgi?user=jtfcht&refer="+escape(document.referrer)+"&cur="+escape(document.URL)+" border=0 alt='网易中文排行榜' ></a>"); <br></script>
            
        


      

    【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】    

    www.bkjia.comtruehttp://www.bkjia.com/PHPjc/316473.htmlTechArticleINDEX.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 ($cm...
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template