conn.asp

来自「一对一校友录多班级而且非常漂亮http://free.cnyys.com/my/」· ASP 代码 · 共 55 行

ASP
55
字号
<%
    on error resume next
	dim conn
	dim dbpath
   	set conn=server.createobject("adodb.connection")
	DBPath = Server.MapPath("school/school.mdb")
	conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath

Function getmsgnum(username) 
	Dim re,Int_num 
	set re=Conn.execute("Select Count(*) from mail where towho='"&username&"' and isread=0") 
	Int_num=re(0) 
	getmsgnum=Int_num 
	re.close 
	set re=nothing 
End Function 

  Const	const_UserOnlineTimeOut=1200 
	dim wzip
	if	session("wzname")="" then 
		if session("wzip")=""	then	 
			session("wzip")=getuserip 
		end if 
		wzip=Session("wzip") 
		set rs=conn.execute ("select * from online where ip='"&wzip&"'") 
		if not rs.eof then 
			conn.execute ("update online set newtime='"&now()&"' where ip='"&wzip&"'") 
		else 
			conn.execute ("insert into online(ip,sname,entertime,newtime) values ('"&wzip&"',null,'"&now()&"','"&now()&"')") 
		end if 
		rs.close 
		set rs=nothing 
	else 
		wzip=Session("wzip") 
		set rs=conn.execute ("select * from online where ip='"&wzip&"' and sname='"&Session("wzname")&"'") 
		if not rs.eof then 
			conn.execute ("update online set newtime='"&now()&"' where ip='"&wzip&"'") 
		else 
			conn.execute ("update online set newtime='"&now()&"',sname='"&Session("wzname")&"' where ip='"&wzip&"'") 
		end if 
		rs.close 
		set rs=nothing 
	end  if 
	conn.execute ("delete from online where datediff('s',newtime,now())>"&const_UserOnlineTimeOut) 


function getuserip 
	dim tempuserip 
	Randomize 
	tempuserip=Request.ServerVariables("Remote_host") 
	tempuserip=tempuserip&":"&Fix(Rnd*10000) 
	getuserip=tempuserip 
end function
%>

⌨️ 快捷键说明

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