⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.asp

📁 与asp相关的技术 如数据库和网页设计 很有用的哦
💻 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" value="<%=Session("user_id")%>">
		<input type="submit" name="startchat" value="进入聊天室" class="buttonstyle">
		<p>请选择一个聊天室:
		<%
		'利用循环显示所有聊天室
		Dim I
		For I=0 To Ubound(allChatRoom)
			%>
			<input type="radio" name="chatroom" value="<%=allChatRoom(I)%>" <%If I=0 Then Response.Write "Checked"%>><%=allChatRoom(I)%>
			&nbsp;(<%=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 + -