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

📄 index.asp

📁 课程设计系列(ASP)代码开发的聊天室程序。
💻 ASP
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>聊天室主界面</title>
</head>
<!-- #include file="conn.asp" -->
<%
dim i,online,rs,sql '定义程序中所用到的变量
online=request.Form("username") '取得网友昵称
'检查用户名是否存在 若存在则返回登录页面
set rs=Server.CreateObject("ADODB.RecordSet")
sql="select  * from  online  where id ORDER BY id DESC"
rs.open sql,conn,1,1
'比较用户输入的昵称和数据库中是否有已存在的用户名
   for i=1 to 50
   	if rs.EOF Then Exit For
	if STRCOMP(rs("username"),online)=0 then
	response.Redirect("index.htm")
	Exit For
	end if
	rs.movenext
   next
dim fen,shi 
fen=minute(time)'time函数返回系统时间
shi=hour(time) 'minute和hour两个函数分别返回时间的分和时
if len(fen)<2 then
fen="0"&fen
end if
if len(fen)<1 then
fen="0"&"0"
end if
if len(shi)<2 then
shi="0"&shi
end if
if len(shi)<1 then
shi="0"&"0"
end if
'将时间中的小时和分钟用4位数来表示
nowtime=shi&fen
'把用户名添加到在线名单中
set rs1=Server.CreateObject("ADODB.RecordSet")
sql="select * from online where id is null"
rs1.open sql,conn,1,3
rs1.addnew
rs1("onlinetime")=nowtime
rs1("username")=online
rs1.update
session("username")=online '使用session保存用户昵称
%>
<frameset rows="50,*" frameborder="NO" border="0" framespacing="0">
  <frame src="top.asp" name="top" scrolling="no" noresize >
  <frame src="main.asp?myself=<%=online%>" name="main">
</frameset>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -