📄 default.asp
字号:
<% Option Explicit %>
<!-- #include file="constants.inc" -->
<%
Dim ChatID
Dim requestedUsername
ChatID = Request("ChatID")
requestedUsername = Server.HTMLEncode( Request("username") )
If (ChatID <> "") Then
Response.Redirect "chat.asp?ChatID=" & ChatID
Response.End
End If
Dim mode, x, errorMessage
mode = Request("mode")
If ( (mode = "userLogin") ) Then
If ( Len(Request("username")) < 1 ) Then
errorMessage = "你已经进入了一个用户,然后开始聊天."
Else
requestedUsername = Left(requestedUsername, 20)
If (Not FindUser(requestedUsername) AND (InStr(requestedUsername, "|") = 0)) Then
ChatID = CStr(Timer) ' safe enough for now
Application.Lock
Application.StaticObjects.Item("ASPChat").Add ChatID, requestedUsername
Application.StaticObjects.Item("ASPChatTime").Add ChatID, CStr(Now())
For x = MESSAGES To 2 Step -1
Application("chatline_" & x) = Application("chatline_" & x-1)
Next
Application("chatline_1") = "<tr><td align='right'><img src='images/Enter.gif' height=14 width=14> </td><td><span class='loggedIn'>" & requestedUsername & " logged on at " & now & "</span></td></tr>"
Application.Unlock
Response.Redirect "Chat.asp?ChatID=" & ChatID
Response.End
Else
errorMessage = "抱歉,但名字,你选择的是已经在使用. 请选择另一个."
End If
End If
End If
%>
<html>
<head>
<title>Bm8.COm.Cn 在线聊天室</title>
<link rel="stylesheet" type="text/css" href="Chat.css">
<script language="JavaScript">
<!--
function setFocus()
{
document.frmLogin.username.focus();
}
// -->
</script>
</head>
<body topmargin="1" leftmargin="1" marginwidth="1" marginheight="1">
<form name="frmLogin" method="POST" action="Default.asp">
<input type="hidden" name="mode" value="userLogin">
<div align="center">
<center>
<table border="0" cellspacing="0" cellpadding="4" width="200">
<tr>
<td colspan="2"><span class="Error"><%=errorMessage%></span></td>
</tr>
<tr>
<td bgcolor="#800000" colspan="2">
<b><font color="#FFFFFF"> Bm8 3.0</font></b>
</td>
</tr>
<tr>
<td colspan="2">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="50%">用户名: </td>
<td width="50%"><input type="text" name="username" class="editField" size="15" tabindex="1"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td> </td>
<td align="right">
<input type="image" name="login" value="submit" src="images/Chat.jpg" border="0" width="90" height="30" tabindex="2">
</td>
</tr>
<tr>
<td colspan="2"><hr noshade color="#D0D0D0" size="1"></td>
</tr>
<tr>
<td colspan="2">目前在线会员 (最大<%=USERS%>):</td>
</tr>
<%
Dim arUserNames, arUserIDs, i, chatName
arUserIDs = Application.StaticObjects.Item("ASPChat").Keys
arUserNames = Application.StaticObjects.Item("ASPChat").Items
For i = 0 To Application.StaticObjects.Item("ASPChat").Count-1
If (ChatID = arUserIDs(i)) Then
chatName = "<b>" & arUserNames(i) & "</b>"
Else
chatName = arUserNames(i)
End If
If ( i MOD 2 ) Then
Response.Write "<tr bgcolor='#F8F8F8'>"
Else
Response.Write "<tr>"
End If
Response.Write " <td><img src='images/Chatter.gif' width=16 height=16></td>"
Response.Write " <td width='100%' class='infoText'>" & chatName & " </td>"
Response.Write "</tr>"
Next
If (Application.StaticObjects.Item("ASPChat").Count = 0) Then
%>
<tr>
<td colspan="2" class="infoHeader"> No users currently logged in.</td>
</tr>
<%
End If
%> </table>
</center>
</div>
</form>
<script language="JavaScript">
setFocus();
</script>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -