灿斌工作室Ajax无刷新聊天室 2.0 for BBSXP 2008

灿斌工作室Ajax无刷新聊天室 2.0 for BBSXP 2008

By admin at 2008-06-28
0人收藏 • 2520人看过

灿斌工作室Ajax无刷新聊天室 2.0 for BBSXP 2008


这个版本的更新:
增加了在线列表(1.0的是摆设)
优化了速度
可以删除聊天记录了


本插件有灿斌工作室的CEO林灿斌亲自开发,未经许可,禁止修改和转载!
若想转载,请登陆http://cbgzs.8800.org发帖申请!
技术支持:
网站支持:http://cbgzs.8800.org
QQ:517038270


此插件适用与BBSXP 2008
若想要其他版本的
请联系林灿斌定做
本插件无须升级数据库
绝对安全


安装步骤
1.打开Loading.asp
找到
 case "Reputation"
  CommentFor=HTMLEncode(unescape(Request.QueryString("CommentFor")))
  CommentBy=HTMLEncode(unescape(Request.QueryString("CommentBy")))
  if CommentFor<>empty then
   Sql=" from ["&TablePrefix&"Reputation] where CommentFor='"&CommentFor&"'"
   TitleStr="评价人"
   PageUrl="CommentFor="&CommentFor
  elseif CommentBy<>empty then
   Sql=" from ["&TablePrefix&"Reputation] where CommentBy='"&CommentBy&"'"
   TitleStr="被评价人"
   PageUrl="CommentBy="&CommentBy
  end if
  
  PageSetup=5 '设定每页的显示数量
  TotalCount=Execute("Select count(ReputationID)"&Sql)(0)
  TotalPage=Abs(Int(TotalCount/PageSetup*(-1))) '总页数 
  PageCount = RequestInt("PageIndex") '获取当前页
  if PageCount <1 then PageCount = 1
  if PageCount > TotalPage then PageCount = TotalPage
  TopCount=PageCount*PageSetup


  if TotalCount<1 then
   CommentAreaStr="<table cellspacing=0 cellpadding=0 width='100%' class='PannelBody'><tr><td>暂时没有相关评价</td></tr></table>"
  else
   Set Rs=Execute("select top "&TopCount&" *"&Sql&" order by DateCreated desc")
   If TotalPage>1 then Rs.Move (PageCount-1) * PageSetup
   i=0
   CommentAreaStr="<table cellspacing=0 cellpadding=0 width='100%' class='PannelBody' style='table-layout: fixed'><tr align=center><td width='15%'>&nbsp;</td><td width='60%'>评价内容</td><td width='25%'>"&TitleStr&"</td></tr>"
   do while not Rs.eof and i<PageSetup
    i=i+1
    if Rs("Reputation")>0 then
     ReputationTitle="好评"
     ImgUrl="Reputation_Excellent.gif"
     FontColor="#FF0000"
     ReputationValue="+"&Rs("Reputation")&""
     
    elseif Rs("Reputation")=0 then
     ReputationTitle="中评"
     ImgUrl="Reputation_Average.gif"
     FontColor="#007700"
     ReputationValue="不计分"
    else
     ReputationTitle="差评"
     ImgUrl="Reputation_Poor.gif"
     FontColor=""
     ReputationValue=Rs("Reputation")
    end if

    CommentAreaStr=CommentAreaStr&"<tr>"
    CommentAreaStr=CommentAreaStr&"<td align=center width='15%'><img src='images/"&ImgUrl&"'> <font color='"&FontColor&"'>"&ReputationTitle&"</font><br />( "&ReputationValue&" )</td>"
    CommentAreaStr=CommentAreaStr&"<td width='60%'>"&Rs("Comment")&" <em><font color=#C0C0C0>"&Rs("DateCreated")&"</em></font></td>"
   if CommentFor<>empty then
    CommentAreaStr=CommentAreaStr&"<td width='25%' align=center><a href='?UserName="&Rs("CommentBy")&"'>"&Rs("CommentBy")&"</a></td>"
   else
    CommentAreaStr=CommentAreaStr&"<td width='25%' align=center><a href='?UserName="&Rs("CommentFor")&"'>"&Rs("CommentFor")&"</a></td>"
   end if
    CommentAreaStr=CommentAreaStr&"</tr>"
    Rs.movenext
   loop
   
   CommentAreaStr=CommentAreaStr&"<tr><td colspan=3 align=right>"&AjaxShowPage(TotalPage,PageCount,"Loading.asp?menu=Reputation&"&PageUrl)&"</td></tr>"
   CommentAreaStr=CommentAreaStr&"</table>"
   Rs.close
   Set Rs = Nothing
  end if
  response.Write(CommentAreaStr)

在下面加上
case "response"
Response.ContentType="text/html; charset=gb2312" '//输出简体中文数据
Sql="Select * From ["&TablePrefix&"PrivateMessages] where Subject='群消息' order by MessageID"
Rs.Open Sql, Conn, 1,1
Do While Not Rs.Eof%><p>
<a href=javascript:Ajax_CallBack(false,false,'loading.asp?menu=DelMessages&ID=<%=RS("MessageID")%>');>删</a>
<%if Rs("SenderUserName")=CookieUserName then%>
&nbsp;&nbsp;&nbsp;<font color=#008040><b><%=Rs("SenderUserName")%></b>&nbsp;&nbsp;(<%=Rs("CreateTime")%>)</font>
<br>&nbsp;&nbsp;&nbsp;&nbsp;<%=BodyEncode(Rs("Body"))%>
<%else%>
&nbsp;&nbsp;&nbsp;<font color=#0000FF><b><%=Rs("SenderUserName")%></b>&nbsp;&nbsp;(<%=Rs("CreateTime")%>)</font>
<br>&nbsp;&nbsp;&nbsp;&nbsp;<%=BodyEncode(Rs("Body"))%>
<%end if%></p><%
Rs.Movenext
Loop
Rs.Close


case "receive"
if CookieUserName<>empty then
Text=HTMLEncode(Request("Text"))
Sql="Select * From ["&TablePrefix&"PrivateMessages]"
Rs.Open Sql,Conn,1,3
Rs.Addnew
Rs("SenderUserName")=CookieUserName
Rs("Body")=Text
Rs("CreateTime")=Now
Rs("Subject")="群消息"
Rs.Update
Rs.Close
end if

case "List"
Sql="Select top 50 * From ["&TablePrefix&"UserOnline] Where UserName<>''"
Rs.Open Sql,Conn,1,1
Do While Not Rs.Eof%>
<%=Rs("UserName")%><br>
<%
Rs.Movenext
Loop
Rs.Close


case "DelMessages"
if CookieUserName<>empty and BestRole=1 then
ID=int(Request("ID"))
conn.execute("delete from ["&TablePrefix&"PrivateMessages] where MessageID="&ID&" and Subject='群消息'")
end if

2.打开Setup.asp
找到<a href="Search.asp?ForumID=<%=RequestInt("ForumID")%>">搜索</a>
在下面加上
 | <a href=javascript:BBSXP_Modal.Open('chat.asp',528,320) title=点击在新窗口中打开聊天室 style=cursor:hand>聊天室</a>

还有在登陆后做个连接

3.把chat.asp传上去
完成了
感谢林灿斌吧!!!

[ybbtopic=5]chat.asp文件内容
<!-- #include file="Setup.asp" -->
<%
HtmlHead
%>
<title>  <%=SiteConfig("SiteName")%> - 超级聊天室</title>
<style>
.ChatBody {
 margin-bottom: 20px;
 height: 185px;
 overflow: auto;

scrollbar-face-color:#eee;
scrollbar-track-color:#eee;
scrollbar-arrow-color:#aaa;
scrollbar-shadow-color:#aaa;
scrollbar-highlight-color:#aaa;
scrollbar-3dlight-color:#eee;
scrollbar-darkshadow-Color:#eee;
}
.ListBody {
 margin-bottom: 0px;
 height: 170px;
 overflow: auto;

scrollbar-face-color:#eee;
scrollbar-track-color:#eee;
scrollbar-arrow-color:#aaa;
scrollbar-shadow-color:#aaa;
scrollbar-highlight-color:#aaa;
scrollbar-3dlight-color:#eee;
scrollbar-darkshadow-Color:#eee;
}
</style>

<script language="JavaScript">
 
 function scrollmove() {
    ChatBody.scrollTop = ChatBody.scrollHeight;
  }

 function GetAJAX(){

  var xmlhttp=false;

 if (window.ActiveXObject) {
var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
 }
 else if (window.XMLHttpRequest) {
var xmlhttp=new XMLHttpRequest();
}

  xmlhttp.open("POST","Loading.asp?menu=response",true);
  xmlhttp.send(null);
  xmlhttp.onreadystatechange=function() {
   if ( xmlhttp.readyState==4 || xmlhttp.readyState=='complete' ){
    ChatBody.innerHTML = xmlhttp.responseText;
    scrollmove();
   }
  }
 }


 function SendAJAX(){
  if (ChatForm.ChatText1.value != "" && ChatForm.ChatText2.value != ""){

 Ajax_CallBack(false,false,"Loading.asp?menu=receive&Text="+ChatForm.ChatText2.value+"");
 
   ChatForm.ChatText2.value = "";
   GetAJAX();
  }
 }
 

 setInterval('GetAJAX()',1500); 

</script>


<body Onload="javascript:GetAJAX();">
<table border="0">
  <tr width="340">

   <form id="form1" name="ChatForm" method="post">
    <td width="340"><div class="ChatBody" id="ChatBody">正在加载中……</div>
      你当前的账号:<input name="ChatText1" title='你当前的账号' type="text" size="8" disabled=true readonly=true value="<%=CookieUserName%>"/>
<input class=button <%if CookieUserName=empty then%>disabled=true readonly=true <%end if%>type="button" name="Submit" value="发送" onclick="SendAJAX();" />


      <textarea name="ChatText2" style="width:99%;height:70px" maxlength="1000" />
</textarea>
  </td>
    </form>

<td width="151">
<table align=center cellspacing=1 cellpadding=5 width=100%  class="CommonListArea" border=0>
 <tr  class=CommonListTitle>
  <td><a style=cursor:hand onclick="javascript:Ajax_CallBack(false,'List','loading.asp?menu=List');" title='点击刷新在线列表'><b>在线列表</b>
</a></td>
 </tr>

<tr class="CommonListCell">
<td>
<b>群公告:</b><br>
各位若有问题请先到论坛发帖!那样能留下记录供后来者作为资料。群里主要是一般交谈与闲聊
</td></tr>

<tr class="CommonListCell">
<td>
<div width="111" class="ListBody" id="List">正在加载中……</div>
</td></tr>
</table>

</td>
<script>
Ajax_CallBack(false,'List','loading.asp?menu=List');
</script>
  </tr>

  </form>
</table>

[/ybbtopic]

因为灌水的人太多了

所以此贴锁

再有灌水者,封特征码

永世不得踏入本坛获取插件

[此帖子已被 admin 在 2008-6-28 14:56:16 编辑过]

[此帖子已被 admin 在 2008-6-28 15:01:45 编辑过]

[此帖子已被 admin 在 2008-6-28 16:43:52 编辑过]

[此帖子已被 admin 在 2008-6-29 15:05:41 编辑过]

10 个回复 | 最后更新于 2009-06-19
ckc
2008-06-28
#1

改的还蛮多....

研究下

lxq123700
2008-06-28
#2

谢谢灿斌兄,你真有才

admin
2008-06-28
#3

不用了

多介绍点人来我这里就可以了

178911360
2008-06-28
#4

谢谢提供~~~~~~~~~~~

admin
2008-06-29
#5

不用谢

记得多发帖

yszx
2009-06-10
#6

我是为了这个来的~~~~~

sml0625
2009-06-14
#7

太有才了,感谢一下!

jiyanhua
2009-06-18
#8

这里真是个好地方

jiyanhua
2009-06-18
#9

chat.asp

ZAI NA LI YA?

sml0625
2009-06-19
#10

灿斌工作室Ajax无刷新聊天室 2.0 for BBSXP 2008.1
滚动条搬动时过1秒左右自动往下掉,能拖到哪停哪不?


登 录


现在注册

QQ  登 录    Weibo  登 录    GitHub  登 录