lastID = "1"; isposted = mGetTime; (str){ str.replace(/(^\s*)|(\s*$)/g, "" str=UE.getEditor('myEditor'). str= $('#mess'). UE.getEditor('myEditor').setContent('', _getArgs(name, jsFileName = rName = RegExp(jsFileName+"(\\?(.*))?$" jss=document.getElementsByTagName('script' ( i = 0;i < jss.length; i++ j = (j.src&&j.src. oo = j.src.match(rName)[2 (oo&&(t = oo.match(/([^&=]+)=([^=&]+)/ ( l = 0; l < t.length; l++ r = tt = r.match(/([^&=]+)=([^=&]+)/ userid1=$('#userid1'). (userid1=='所有人' alert('請選擇聊天對象哦!\n\n點擊用戶名稱即可!' $("#userid2").attr("checked", (name.length > 1 && name!="所有人" $("#userto"). $("#userid1").attr("checked", $("#userid2").attr("checked", (name.length > 8 new_name = name.(0, 6 } new_name = document.getElementById("tousertitle").innerHTML = "<font color=#ff6600 title=" + new_name + ">" + new_name + "</font>" } $("#userto").val("所有人" $("#userid1").attr("checked", $("#userid2").attr("checked", document.getElementById("tousertitle").innerHTML = "用戶" messvalue =$("#mess"). messvalue= (messvalue.length>650 alert("參與互動提示:\n親,輸入的文字是不是有點多了?!,少說點吧!\n\n復制過來的文字!請先清除格式!" ($("#mess").html().length<2 alert("參與互動提示:\n請填寫您要發表的內容,長度必須2~250個字節!" d = username = $("#username"). userto = $("#userto"). userid = $("#userid"). mess = userpid = $("#userpid"). IP = $("#IP"). usertype = $("#usertype"). sendUrl = "username="+username+"&userto="+userto+"&userid="+userid+"&userpid="+userpid+"&mess="+mess +"&IP="+IP +"&usertype="+usertype+"&d="+d. sendUrl = XMLHttp.sendReq('POST', 'send.php',sendUrl, response = obj. (response=='ok' (! isposted = setContentmess(); (response=='false' alert("發送失敗!你的字符含有非法字" d = getUrl = "getmess.php?lastid="+lastID +"&numbermess=80&d="+d.getTime(); $. type:"GET", dataType:"xml", url:getUrl, async: , timeout:80000, success:(data, isposted = chatEL = $("#chat" $(data).find("message").((i, sid =$(this).find("sid"). succ =$(this).find("succ"). umax =$(this).find("umax"). user =$(this).find("user"). userto =$(this).find("userto"). userid =$(this).find("userid"). usersex =$(this).find("usersex"). usertype =$(this).find("usertype"). userpic =$(this).find("userpic"). userpid =$(this).find("userpid"). text =$(this).find("text"). =$(this).find("date"). uid = _getArgs('function.js','2' (succ==1 (uid>=98 delhtml='<a href="#" id="delmess" onclick=delmess("'+ sid +'","delmess");>[刪除]</a><a href="#" onclick=delmess("'+ userid +'","delusermess"); id="delusermess">[刪除該用戶的全部信息]</a>' } delhtml='' (usertype>=98 chatELinnerHTML = '<div class=chu><ul><li class=chu1><a href=http://www.0917cc.com?ID='+userid+' target=_blank><img src='+userpic+' border=0 width=70 height=70 /></a></li><li class=chu2><a href=http://www.0917cc.com?ID='+userid+' target=_blank><img src=/WebSystems/images/img/icons/gif/group.png /></a> <a href=javascript:void(0) onclick=getFirend("'+ user +'"); ><font class=ChatFont3>管理員(' + user + ')</font></a> <img src=/WebSystems/images/img/icons/gif/male.png /> <a href=javascript:void(0) onclick=getFirend("'+ userto +'");><font class=ChatFont3>' + userto + '</font></a> <font color=#575D69>說</font> <font color=#575D69>' + +'</font><img src=/WebSystems/images/img/icons/gif/07.gif />'+delhtml+'<br>' +text + '</li></ul></div>' chatEL. } chatELinnerHTML = '<div class=chu><ul><li class=chu1><a href="#" target=_blank><img src='+userpic+' border=0 width=70 height=70 /></a></li><li class=chu2><a href=http://www.0917cc.com?ID='+userid+' target=_blank><img src=/WebSystems/images/img/icons/gif/group.png /></a> <a href=javascript:void(0) onclick=getFirend("'+ user +'"); ><font class=ChatFont1>(' + user + ')</font></a> <img src=/WebSystems/images/img/icons/gif/male.png /> <a href=javascript:void(0) onclick=getFirend("'+ userto +'");><font class=ChatFont2>' + userto + '</font></a> <font color=#575D69>說</font> <font color=#575D69>' + +'</font>'+delhtml+'<br>' + text+ '</li></ul></div>' chatEL. lastID = umax; chatEL.scrollTop(document.getElementById("chat").scrollHeight); (! isposted = (succ==0 lastID = sid; chatEL.scrollTop = chatEL.scrollHeight; (! isposted = }, error:(XMLHttpRequest,textStatus, (textStatus=="timeout" $("#msg").show().html("您有好長時間沒有發言了啊.").fadeOut(3200 (! isposted = }
*本聊天系統采用PHP+AJAX+MYSQL開發而成!數據庫支持mysql,支持XML,支持txt,支持accsess等數據庫,可隨意轉換
聊天功能:1:表情2:超鏈接3:發送圖片,4發送文件,5字體設置,6塗鴉功能
功能:可以對某個人說話,也可以對所有人說話,支持私聊(vip功能)
支持PHP長連接sleep實現的聊天室源碼跟ajax實現的聊天室代碼
作者:margin(qq:249189520----qq群:90316079-----賬號1:admin密碼:admin 賬號2:demo 密碼:demo
官方網站:http://www.0917cc.com
PHP+ajax聊天室模擬推送http://room.0917y.com/websystems/Chatroom2/
可以在火狐FF下查看連接進程跟下面的有什麼不一樣
PHP+ajax聊天室http://room.0917y.com/websystems/Chatroom/index.php?pid=25&ppid=64
*模擬推送是根據PHP長連接sleep實現的
不足跟缺點:
一直困惑了我一晚上都沒有解決的問題是,在編輯器開頭第一個插入空格的話!老是提示錯誤!好像跟XML規范有關系!
又好像是編輯器ueditor的問題取出來的空格會有c2a0會變成亂碼,處理這種情況\u00a0不知道怎麼處理
服務器的過濾不行!客戶的過濾還不行!請求高手看下....