📄 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="rgb(224,241,227)">
<p><font color="#FF00FF"><small><strong>现在时间是:</strong></small></font></p>
<font color="green"><em><strong><% =" " & now %>
</strong></em></font>
<hr>
<p><strong><font color="#FF00FF"><small>你上站时间为:<br>
</small></font><br>
<font color="green"><em><% =newrecord(0) %></em></font></strong><br>
<font color="#0080FF"><strong><br>
</strong></font></p>
<hr>
<p><font color="#FF00FF"><strong><small>你共聊了:</small><br>
</strong></font></p>
<font color="green"><strong><em><% =TotalTime & " 分钟!" %>
</em></strong></font>
<p><font color="#FF00FF"><strong><small>小心别太沉迷聊天!</small><br>
</strong></font></p>
<%
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 + -