📄 history.asp
字号:
<%Option Explicit%>
<!-- #include file="constants.inc" -->
<%
Dim ChatID
ChatID = Request("ChatID")
If ( (ChatID = "") Or (Not Application.StaticObjects.Item("ASPChat").Exists(ChatID)) ) Then
Response.Redirect "Expired.asp"
Response.End
Else
End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta HTTP-EQUIV="Refresh" CONTENT="10; URL=History.asp?ChatID=<%=ChatID%>">
<title>bm8</title>
<link rel="stylesheet" type="text/css" href="Chat.css">
</head>
<body>
<script language="JavaScript">
<!-- // hide from challenged browsers
// Call this to refresh the frames
if (parent.frames.length!=0)
{
RefreshFrame("Chatters", "Chatters.asp?ChatID=<%=ChatID%>");
}
function RefreshFrame(FrameName, PageName)
{
eval("parent." + FrameName + ".location='" + PageName + "'");
}
// -->
</script>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<%
Dim chatName
If (Application.StaticObjects.Item("ASPChat").Exists(CStr(ChatID))) Then
chatName = Application.StaticObjects.Item("ASPChat").Item(CStr(ChatID))
Else
chatName = "Guest"
End If
If ( Len(Request("logoff.x")) > 0) Then
Dim x
Application.Lock
For x = MESSAGES To 2 Step - 1
Application("chatline_" & x) = Application("chatline_" & x-1)
Next
Application("chatline_1") = "<tr><td class='Name' align='right'><img src='images/Exit.gif' height=14 width=14> </td><td colspan='2'><span class='LoggedOut'>" & chatName & " 离开了 " & Now() & "</span></td></tr>"
' remove user
Application.StaticObjects.Item("ASPChat").Remove(CStr(ChatID))
Application.StaticObjects.Item("ASPChatTime").Remove(CStr(ChatID))
Application.UnLock
%>
<script language="javascript">
top.location.href = "Default.asp";
</script>
<%
Else
If ( Request("mode") = "message" ) Then
Dim textMessage
textMessage = Request("message")
If (Len(textMessage) > 0) Then
textMessage = Server.HTMLEncode(textMessage)
textMessage = Replace(textMessage, "<b>", "<b>", 1, -1, 1)
textMessage = Replace(textMessage, "</b>", "</b>", 1, -1, 1)
textMessage = Replace(textMessage, "<i>", "<i>", 1, -1, 1)
textMessage = Replace(textMessage, "</i>", "</i>", 1, -1, 1)
textMessage = Replace(textMessage, "<u>", "<u>", 1, -1, 1)
textMessage = Replace(textMessage, "</u>", "</u>", 1, -1, 1)
textMessage = CheckProfanity(textMessage)
Dim i, text
Application.Lock
For i = MESSAGES To 2 Step -1
Application("chatline_" & i) = Application("chatline_" & i-1)
Next
text = "<tr>" & _
"<td nowrap align='right' valign='top' class='Name'>" & chatName & "<img src='images/Chatter.gif'></td>" & _
"<td class='Message' align='left' width='100%'>" & textMessage & "</td>" & _
"</tr>" & vbCrLf
Application("chatLine_1") = text
Application.StaticObjects.Item("ASPChatTime").Item(ChatID) = CStr(Now())
Application.UnLock
End If
End If
End If
' Check if Users need to be dropped.
Dim arUserTimes, timeIdx, curTimestamp
arUserTimes = Application.StaticObjects.Item("ASPChatTime").Keys
curTimestamp = Now()
For timeIdx = 0 To Application.StaticObjects.Item("ASPChatTime").Count-1
If (DateDiff("s", CDate(Application.StaticObjects.Item("ASPChatTime").Item(arUserTimes(timeIdx))), curTimestamp) > TIMEOUT) Then
' Drop the user
Application.Lock
' Broadcast User has left
For x = MESSAGES To 2 Step - 1
Application("chatline_" & x) = Application("chatline_" & x-1)
Next
Application("chatline_1") = "<tr><td class='Name' align='right'><img src='images/Exit.gif' height=14 width=14> </td><td><span class='LoggedOut'>" & Application.StaticObjects.Item("ASPChat").Item(arUserTimes(timeIdx)) & " 最后发言 " & Now() & "</span></td></tr>"
Application.StaticObjects.Item("ASPChat").Remove(arUserTimes(timeIdx))
Application.StaticObjects.Item("ASPChatTime").Remove(arUserTimes(timeIdx))
Application.UnLock
End If
Next
If ( CLEAR_ON_EMPTY AND (Application.StaticObjects.Item("ASPChat").Count = 0) ) Then
' clear all messages
Application.Lock
For i = 1 To MESSAGES
Application("chatline_" & i) = ""
Next
Application.UnLock
End If
' print all messages in window
For i = 1 To MESSAGES
Response.Write Application("chatline_" & i) & ""
Next
%>
</table>
</body>
</html>
<%
Function CheckProfanity( Text )
Dim arrSwear, x, n
'Get the Arrays
arrSwear = Application("SwearWords")
Text = Split(Text, " ")
For x = LBound(Text) To UBound(Text)
'Check if it is profane
For n = LBound(arrSwear) To UBound(arrSwear)
If InStr(UCase(Text(x)), arrSwear(n)) > 0 Then
Text(x) = "[Censored]"
Exit For
End If
Next
Next
CheckProfanity = Join(Text, " ")
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -