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

📄 enter.asp.bak

📁 是个关于asp做得聊天室
💻 BAK
字号:
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft FrontPage 4.0">
</HEAD>
<BODY>

<script language="jscript">
<!--
	function Check()
	{ 
		var NotNull
		NotNull=true

			if (document.room.topic =="")
			{
				window.alert("请输入聊天室话题!")
				NotNull=false
			}
			
			if (document.room.newroom =="")  
			{
				window.alert("请输入新房间名!")
				NotNull=false
			}
			
			return NotNull

	}
	
//-->
</script>



<%
'Response.Write Request.ServerVariables ("REQUEST_METHOD")
if Request.ServerVariables ("REQUEST_METHOD")="POST"  then
	dim UserID,IPAdd,UserPwd,NickName,TimeLogin
	dim mysql,mysql1
	
	UserID=Request.Form ("UID")
	UserPwd=Request.Form ("PWD")
	NickName=Request.Form ("NickName")
	session("nickname")=NickName
	
	set myconn=server.CreateObject ("ADODB.Connection")

	myconn.ConnectionString ="DSN=ChatRoom"
	myconn.Open 
	
	mysql="select UserID,PWD,IfClosed,OpenTime from EverUser where UserID='" & UserID & "' and PWD='" & UserPwd & "'"
	mysql1="select IPAdd,TimeOpen,IfClosed from FaultIpAdd where IPAdd='" & Request.ServerVariables ("Remote_Host") & "'"
	mysql2="update EverUser set NickName='" & NickName & "',IPAdd='" & Request.ServerVariables ("Remote_Host") & "',TotalVisit=TotalVisit+1 where UserID='" & UserID & "'"
	mysql3="insert into UserOnLine (UserID,PWD,NickName) values ('" & UserID & "','" & UserPwd & "','" &  NickName &  "')" 
	mysql4=	"select * from RoomInfo"
	mysql5="select * from UserOnLine where UserID='" & UserID & "'"
	
	set myrecord0=myconn.Execute (mysql5)
	
	if not myrecord0.bof then
		'Response.Write myrecord0("TimeLastTalking")
		'Response.Write now
		if dateadd("n",5,myrecord0("TimeLastTalking"))>now then
			Response.Write ("你已经登陆过了,请在五分钟后再登陆!")
			Response.End 
		else
			newsql="delete from UserOnLine where UserID='" & UserID & "'"
		end if
			
		
	end if
	
	set myrecord1=myconn.Execute (mysql1)
	
	'确定是否以前曾经被封过,并判断现在是否已经被解封
	if not myrecord1.bof then
		if myrecord1("IfClosed")<>true then
			IfClosed=1
		end if
	end if

	if myrecord1.bof  or IfClosed=1 then
		
		set myrecord=myconn.Execute(mysql)
	
		if myrecord.eof then
			Response.Write ("密码或帐号输入错误!<a href='default.asp'>请重新登陆</a>")
			Response.End 
		elseif myrecord("IfClosed") then
			if myrecord("OpenTime")<date() then
			Response.Write ("你的帐号刚刚被解封,<a href='default.asp'>请重新登陆</a>,以后请注意!")
			mysql="update EverUser set IfClosed=false where UserID='" & UserID & "'"
			myconn.Execute (mysql)  
			Response.End 
			
			else
			Response.Write ("你的帐号已经被封,到" & myrecord("OpenTime") & "才开放!")
			Response.End 
			
			end if
		else
			if session("refresh")="" then

				myconn.Execute (mysql2)
				myconn.Execute (mysql3)
				session("refresh")=true
			end if
			
			set myrecord2=myconn.Execute (mysql4)
			
			
%>


<form name="room" action="main.asp" method="post" onsubmit="return Check()">
<table border="5" width="100%" bgcolor="#000000" height="39" cellspacing="5" cellpadding="5">
  <tr>
    <td width="50%" height="18">
      <p align="center"><b><font color="#ff0000">新建聊天室</font></b></p></td>
    <td width="50%" height="18">
      <p align="center"><b><font color="#ff0000">话题</font></b></p></td>
    <td width="50%" height="18">
      <p align="center"><input type="submit" value="提交" style="BACKGROUND-COLOR: #00ffff; COLOR: #ff0000; FONT-WEIGHT: bold; TEXT-DECORATION: blink"></p>
    </td>
  </tr>
 
  <tr>
    <td width="50%" height="9">
      <p align="center"><input name="newroom" 
     ></p>
    </td>
    <td width="50%" height="9">
      <p align="center"><input name="topic" 
     ></p>
    </td>
    <td width="50%" height="9">
      <p align="center"><input type="reset" value="清除" name="B2" style="BACKGROUND-COLOR: #00ffff; COLOR: #ff0000; FONT-WEIGHT: bold; TEXT-DECORATION: blink"></p></td>
  </tr>
  
  
</table>

<input type="hidden" name="user" value=<% =UserID %> >
</form>




<hr size="4" color="#000080">
<table border="2" width="100%" background="images/Bg1.gif" cellpadding="2" height="76">
  <tr>
    <td width="10%" align="middle" height="48"><b><font size="3" face="隶书" color="#008000">房间号</font></b></td>
    <td width="20%" align="middle" height="48"><b><font size="3" face="隶书" color="#008000">房间名称</font></b></td>
    <td width="20%" align="middle" height="48"><b><font size="3" face="隶书" color="#008000">话题</font></b></td>
    <td width="20%" align="middle" height="48"><b><font size="3" face="隶书" color="#008000">聊天人数</font></b></td>
    <td width="15%" align="middle" height="48"><b><font size="3" face="隶书" color="#008000">是否上锁</font></b></td>
    <td width="15%" align="middle" height="48"><b><font size="3" face="隶书" color="#008000">创建者</font></b></td>
  </tr>
  
<%
	do while not myrecord2.eof  
	
		if myrecord2("IfLocked")=true then
			newsql="select UserID from UserOnLine where RoomName='" & myrecord2("RoomName") & "' and UserID='" & myrecord2("WhoCreate") & "'"
			set myrecord3=myconn.Execute(newsql)
			if myrecord3.bof then
				newsql="update RoomInfo set IfLocked=false where RoomName='" & myrecord2("RoomName") & "'"
				myconn.Execute (newsql)
				Changed=true
			end if
			myrecord3.close
		end if
%> 
  
  <tr>
    <td width="10%" align="middle" height="2"><P><FONT color=purple face=楷体_GB2312 size=5><STRONG>
<% =myrecord2("RoomID") %></STRONG></FONT></P></td>
<%
	if myrecord2("IfLocked")=false or Changed=true then
%>
    <td width="20%" align="middle" height="2"><FONT color=purple face=楷体_GB2312 size=5><STRONG><% =myrecord2("RoomName") %>    </STRONG></FONT><FONT color=maroon size=2><a href=main.asp?roomname=<% =myrecord2("RoomName") %>&user=<% =UserID %>>进入</a><a></FONT></a></td>
<%
	else
%>
    <td width="20%" align="middle" height="2"><FONT color=purple face=楷体_GB2312 size=5><STRONG><% =myrecord2("RoomName") %>    </STRONG></FONT><FONT color=maroon size=2>锁住</a><a></FONT></a></td>
<%
	end if
%>
    <td width="20%" align="middle" height="2"><P><FONT color=purple face=楷体_GB2312 
     ><STRONG><%  =myrecord2("Topic")  %></STRONG></FONT></P></td>
    <td width="20%" align="middle" height="2"><P><FONT color=purple face=楷体_GB2312 
     ><STRONG><% =myrecord2("HowManyUsers") %></STRONG></FONT></P></td>
    <td width="15%" align="middle" height="2"><P><FONT color=purple face=楷体_GB2312 
     ><STRONG><% =myrecord2("IfLocked") %></STRONG></FONT></P></td>
    <td width="15%" align="middle" height="2"><P><FONT color=purple face=楷体_GB2312 
     ><STRONG><% =myrecord2("WhoCreate") %></STRONG></FONT></P></td>
  </tr>
<P>

<%
		myrecord2.movenext
		
		loop
%>

</table>


<%			
		'session("user")=UserID
		'session("nickname")=NickName
		end if
	else'if  myrecord1("IfClosed")=true then
		if myrecord1("TimeOpen")<date() then
			Response.Write ("你的ip地址刚刚被解封,<a href='default.asp'>请重新登陆</a>,请以后注意!")
			mysql="update FaultIpAdd set IfClosed=false where IpAdd='" & Request.ServerVariables ("Remote_Host") & "'"
			myconn.Execute (mysql)
			Response.End 

		else
			Response.Write ("你的ip地址已经被封住了,直到" & myrecord1("TimeOpen") & "才能开放!")
			Response.End 
		end if

	end if
	
	myrecord.close
	set myrecord=nothing
		
	myrecord1.close
	set myrecord1=nothing
	
	myrecord2.close
	set myrecord2=nothing
	set myconn=nothing
end if

%>



</P>



</BODY>
</HTML>

⌨️ 快捷键说明

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