?? index.asp
字號:
<%option explicit%>
<!--#INCLUDE FILE="function.asp"-->
<!--#INCLUDE FILE="config.asp"-->
<html>
<head>
<title>歡迎頁面</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body >
<br>
<h2 align="center"><%=title%></h2>
<table border="0" cellpadding="4" width="100%">
<tr align="center">
<td>
<form method="post" action="index.asp">
請輸入您的用戶名<input type="text" name="username" size="15">
<input type="submit" name="startchat" value="進入聊天室" class="buttonstyle">
<p>請選擇一個聊天室:
<%
'利用循環顯示所有聊天室
Dim I
For I=0 To Ubound(allChatRoom)
%>
<br><input type="radio" name="chatroom" value="<%=allChatRoom(I)%>" <%If I=0 Then Response.Write "Checked"%>><%=allChatRoom(I)%>
(<%=AllUserName(allChatRoom(I))%>)
<%Next%>
</form>
</td>
</tr>
</table>
<%
If request.form("username")<>"" then
Dim username,chatroom
username=request.form("username")
Session("username")=username
Session("IP")=Request.ServerVariables("REMOTE_ADDR") 'IP地址
chatroom=Request.Form("chatroom")
session("chatroom")=chatroom '保存到Session中
'如果該聊天室名單還沒有初始化,就先初始化
call NewUserName(chatroom)
'下面檢查是否已經有人使用該昵稱
If GetUserName(username,chatroom)=True Then
Response.Write "<p align='center'>已經有人使用該名稱,請重新輸入"
Else
'下面將該用戶保存到數據庫中
Call addUserName(username,chatroom)
'下面將該用戶來到的信息保存到發言信息中
Dim sayStr
sayStr=Time() & "<font color='red'>來自" & Session("IP") & "的" & Session("username") & "大駕光臨</font>"
Application.Lock '先鎖定
Application(session("chatroom"))= Application(session("chatroom")) & "<br>" & sayStr
Application.Unlock '解除鎖定
'重定向
response.redirect "whole.asp"
End If
End If
%>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -