📄 time.asp
字号:
<%
dim overtime
if application(session("myname"))<>"***kickout***" then
set newconn=server.CreateObject ("ADODB.Connection")
newconn.ConnectionString ="DSN=ChatRoom"
newconn.Open
if minute(now)- minute(cdate(application("time")))>=5 or ( minute(now)- minute(cdate(application("time")))<0 and (minute(now)+60-minute(cdate(application("time"))))>=5) then
mysql="select UserID,TimeLastTalking,RoomName from UserOnLine"
set myrecord1=server.CreateObject ("ADODB.Recordset")
myrecord1.Open mysql,"DSN=ChatRoom",1,3
do while not myrecord1.EOF
if minute(now)-minute(cdate(myrecord1("TimeLastTalking")))>=5 or (minute(now)-minute(cdate(myrecord1("TimeLastTalking")))<0 and minute(now)+60-minute(cdate(myrecord1("TimeLastTalking")))>=5) then
Response.Write myrecord1("UserID")
if myrecord1("UserID")=session("myname") then
overtime=1
end if
mysql1="update RoomInfo set HowManyUsers=HowManyUsers-1 where RoomName='" & myrecord1("RoomName") & "'"
application(myrecord1("UserID"))=""
myrecord1.Delete
newconn.Execute (mysql1)
end if
myrecord1.MoveNext
loop
application("time")=now
myrecord1.Close
set myrecord1=nothing
end if
if overtime<>1 then
newsql="select TimeLogin from UserOnLine where UserID='" & session("myname") & "'"
set newrecord=newconn.Execute (newsql)
if not newrecord.bof then
hourdiff=(hour(time)-hour(cdate(newrecord(0))))
if hourdiff<0 then
hourdiff=hourdiff+24
end if
mindiff=(minute(time)-minute(cdate(newrecord(0))))
TotalTime=hourdiff*60 + mindiff
%>
<html>
<head>
<meta http-equiv="refresh" content="10;url=talker.asp">
<title>聊天室程序-上站时间</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
</head>
<body bgcolor="#E6F7FF">
<p><font><strong>现在时间是:</strong></font></p>
<font><% =" " & now %>
</font>
<hr size="1">
<p><strong><font>你上站时间为:<br>
</font><br>
<font><% =newrecord(0) %></font></strong><br>
<br>
</p>
<hr size="1">
<p><font><strong>你共聊了:<br>
</strong></font></p>
<font><strong><% =TotalTime & " 分钟!" %>
</strong></font>
<%
else
%>
<script language="javascript">
<!--
window.alert ("你发呆时间超过5分钟,自动退出!")
top.location.href ="default.asp"
//-->
</script>
<%
end if
else
%>
<script language="javascript">
<!--
window.alert ("你发呆时间过超过5分钟,自动退出!")
top.location.href ="default.asp"
//-->
</script>
<%
end if
newconn.Close
set newconn=nothing
Response.End
else
%>
<script language="javascript">
<!--
window.alert ("你由于表现不好,被管理员踢出!")
top.location.href ="default.asp"
//-->
</script>
<%
end if
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -