The following code is the post. asp file code, which is relatively simple and is not described.
<% @ Language = "JavaScript" CodePage = "936" %> <%
Var Nothing;
Response. addHeader ("Cache-Control", "no-cahce ");
If (! Session. Contents ("Chat_User "))
{
Session. Contents ("Chat_User") = "Guest ";
Session. Contents ("Chat_Time") = (new Date). getTime ();
}
If (Application. Contents ("Chat_Data") = Nothing)
{
Application. Lock ();
Application. Contents ("Chat_Data") = "\ f system \ bred \ B you \ bblue \ B Welcome to the chat room. \ Bblack \ B "+ (3000 + (new Date). getTime ());
Application. UnLock ();
}
Var PostChat = Request. QueryString. Item;
If (PostChat)
{
Var Chat_Data = Application. Contents ("Chat_Data"). split ("\ f ");
If (Chat_Data.length> 30) Chat_Data.shift ();
Chat_Data.push (Server. HtmlEncode (unescape (PostChat) + "\ B" + (new Date). getTime ());
Application. Lock ();
Application. Contents ("Chat_Data") = Chat_Data.join ("\ f ");
Application. UnLock ();
}
Var LastTime = Session. Contents ("Chat_Time ");
Var MyData = new Array;
Var AllData = Application. Contents ("Chat_Data"). split ("\ f ");
For (var C = AllData. length-1; C> = 1; C --)
{
Var Node = new Array;
Var Item = AllData [C]. split ("\ B ");
If (Item [6] <= Session. Contents ("Chat_Time") break;
If (Item [6]> LastTime) LastTime = Item [6];
Node. push ("<sender color = \" "+ Item [1] +" \ ">" + Item [0] + "</sender> ");
Node. push ("<receiver color = \" "+ Item [3] +" \ ">" + Item [2] + "</receiver> ");
Node. push ("<speak color = \" "+ Item [5] +" \ ">" + Item [4] + "</speak> ");
Node = Node. join ("\ t \ r \ n ");
Node = "\ t <chat time = \" "+ Item [6] +" \ ">" + Node + "\ r \ n \ t </chat> ";
MyData. push (Node );
}
Session. Contents ("Chat_Time") = LastTime;
MyData. reverse ();
%> <? Xml version = "1.0" encoding = "gb2312"?>
<Chat room>
<% = MyData. join ("\ r \ n") %>
</Chat room>
Reprinted please indicate the source (www.111cn.net)