?? globals.asp
字號:
<%
'全局數據庫參數.
set schooldb = server.createobject("ADODB.connection")
schooldb.open "dsn=school;uid=sa;pwd="
DBParams=schooldb
'生成HTML腳本時美化生成結果時,自動帶上回車換行符.
CRLF = Chr(13)&Chr(10)
function DateToStr(dtDateTime)
DateToStr = year(dtDateTime) & doublenum(Month(dtdateTime)) & doublenum(Day(dtdateTime)) & doublenum(Hour(dtdateTime)) & doublenum(Minute(dtdateTime)) & doublenum(Second(dtdateTime)) & ""
end function
function doublenum(fNum)
if fNum > 9 then
doublenum = fNum
else
doublenum = "0" & fNum
end if
end function
Function PassWordOK(Byval UserID,Password) 'PasswordOK(UserID,PassWord)
passwordok=true
Set PWrs = Server.CreateObject("ADODB.Recordset")
SQL = "select * from UserInfo where UserID='"&UserID&"'"
PWrs.Open SQL,DBParams
if not PWrs.eof then
if PWrs("userpassword")=password then
passwordok=true
else
passwordok=false
end if
else
passwordok=false
end if
if len(password)>8 or not instr(password,"or")=0 then
passwordok=false
end if
PWrs.Close
set PWrs = nothing
End Function
%>
<%
set rs=server.createobject("adodb.recordset")
set rss=server.createobject("adodb.recordset")
userids=trim(session("userid"))
userips = Request.ServerVariables("REMOTE_ADDR")
if userids<>"" then
flag=0
sql="select * from online where userid='"&userids&"'"
rs.open SQL,schooldb
if not rs.eof then
flag=1
end if
rs.close
sql="select * from userinfo where userid='"&userids&"'"
rs.open SQL,schooldb
if not rs.eof then
session("realnames")=rs("realname")
end if
rs.close
SQL = "select * from userjoinclassinfo where userid='"&userids&"' order by joindate"
rs.open SQL,schooldb
if rs.eof then
if flag=0 then
sql1="select * from online"
rss.open SQL1,schooldb,1,3
rss.AddNew
rss("userid")=userids
rss("userip")=userips
rss("usercometime")=now()
rss("classid")="nothing"
rss.Update
rss.Close
else
set rsup=schooldb.execute("update online set userid='"&userids&"',userip='"&userips&"',usercometime='"&now()&"' where userid='"&userids&"'")
end if
else
fs=0
curclassids=trim(session("classid"))
if curclassids="" then
fs=1
curclassids=rs("classid")
end if
if flag=0 then
sql1="select * from online"
rss.open SQL1,schooldb,1,3
rss.AddNew
rss("userid")=userids
rss("userip")=userips
rss("usercometime")=now()
rss("classid")=curclassids
rss.Update
rss.Close
else
set rsup=schooldb.execute("update online set userid='"&userids&"',userip='"&userips&"',usercometime='"&now()&"',classid='"&curclassids&"' where userid='"&userids&"'")
end if
if fs=0 then
'rss("logintimes")=rss("logintimes")+1
set rs1=schooldb.execute("update userjoinclassinfo set lastlogintime='"&now&"',logintimes="&(rs("logintimes")+1)&" where userid='"&userids&"' and classid='"&session("classid")&"'")
end if
end if
rs.close
end if
%>
<%timeouts=DateToStr(now())-1200
times=cdbl(timeouts)
set rsss=schooldb.execute ("select * from online")
while not rsss.eof
if cdbl(DateToStr(rsss("usercometime")))<times then
id=rsss("id")
SQL = "delete online where id="&id&""
set rs3=schooldb.execute(sql)
end if
rsss.movenext
wend
%>
<html><script language="JavaScript"> </script></html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -