<% dim rs,sql dim stats,ComeFrom stats=request.cookies("aspsky")("stats") ComeFrom=address(Request.ServerVariables("REMOTE_HOST")) actCome=address(Request.ServerVariables("HTTP_X_FORWARDED_FOR")) statuserid=replace(Request.ServerVariables("REMOTE_HOST"),".","") set rs=server.createobject("adodb.recordset") if membername="" then if session("userid")="" then 'sql="select * from online" sql="insert into online(id,username,userclass,ip,startime,lastimebk,lastime,browser,stats,actforip,ComeFrom,actCome) values "&_ "("&statuserid&",'客人','客人','"&_ Request.ServerVariables("REMOTE_HOST")&"',now(),now(),'"&DateToStr(now())&"','"&_ Request.ServerVariables("HTTP_USER_AGENT")&"','论坛首页','"&_ Request.ServerVariables("HTTP_X_FORWARDED_FOR")&"','"&ComeFrom&"','"&actCome&"')" conn.execute(sql) else sql="select * from online where id="&cstr(session("userid")) rs.open sql,conn,1,3 if rs.eof and rs.bof then sql="insert into online(id,username,userclass,ip,startime,lastimebk,lastime,browser,stats,actforip,ComeFrom,actCome) values "&_ "("&statuserid&",'客人','客人','"&_ Request.ServerVariables("REMOTE_HOST")&"',now(),now(),'"&DateToStr(now())&"','"&_ Request.ServerVariables("HTTP_USER_AGENT")&"','论坛首页','"&_ Request.ServerVariables("HTTP_X_FORWARDED_FOR")&"','"&ComeFrom&"','"&actCome&"')" conn.execute(sql) else sql="update online set lastimebk=now(),lastime='"&DateToStr(now())&"',ComeFrom='"&ComeFrom&"',actCome='"&actCome&"' where id="&cstr(session("userid")) conn.execute(sql) end if end if session("userid")=statuserid else sql="select * from online where username='"&membername&"'" rs.open sql,conn,1,3 if rs.eof and rs.bof then sql="insert into online(id,username,userclass,ip,startime,lastimebk,lastime,browser,stats,actforip,ComeFrom,actCome) values "&_ "("&statuserid&",'"&membername&"','"&memberclass&"','"&_ Request.ServerVariables("REMOTE_HOST")&"',now(),now(),'"&DateToStr(now())&"','"&_ Request.ServerVariables("HTTP_USER_AGENT")&"','论坛首页','"&_ Request.ServerVariables("HTTP_X_FORWARDED_FOR")&"','"&ComeFrom&"','"&actCome&"')" conn.execute(sql) else sql="update online set lastimebk=now(),lastime='"&DateToStr(now())&"',ComeFrom='"&ComeFrom&"',actCome='"&actCome&"' where username='"&membername&"'" 'response.write sql conn.execute(sql) end if rs.close end if '删除20分钟不活动用户 dim strOnlineTimedOut strOnlineTimedOut = 1200 sql="Delete FROM online WHERE DATEDIFF('s', lastimebk, Now()) > "&strOnlineTimedOut&"" 'sql="delete from online where lastime<'" & strOnlineTimedOut & "'" Conn.Execute sql set rs=nothing response.write ""&_ "
" if membername<>"" then response.write "我参与的主题 | 已被回复的我的发言" end if response.write "" if Cint(online())>Cint(Maxonline) then conn.execute("update config set Maxonline="&online()&",MaxonlineDate=Now()") application("Maxonline")=online() application("MaxonlineDate")=now() end if 'ON ERROR RESUME NEXT if membername<>"" then call getRe() if Cint(incept())>Cint(0) then if openmsg=0 then response.write "您有新短消息" else response.write "" end if end if end if response.write "
" function online() rs=conn.execute("Select Count(*) From online") online=rs(0) set rs=nothing if isnull(online) then online=0 end function '统计留言 function incept() incept=0 rs=conn.execute("Select Count(id) From Message Where flag=0 And incept='"& membername &"'") incept=rs(0) set rs=nothing if isnull(incept) then incept=0 end function function allincept() rs=conn.execute("Select Count(id) From Message Where flag=0 And incept='"& membername &"'") allincept=rs(0) set rs=nothing if isnull(allincept) then allincept=0 end function function allsend() rs=conn.execute("Select Count(id) From Message Where flag=0 And sender='"& membername &"'") allsend=rs(0) set rs=nothing if isnull(allsend) then allsend=0 end function sub getRe() dim rs1, reAnn, boardID, ID set rs1=conn.execute("select ReAnn from [user] where username='"& membername &"' and showRe=1 and reAnn is not null") if not(rs1.eof and rs1.bof) then reAnn=rs1("reAnn") boardID=split(reAnn,"|")(0) ID=split(reAnn,"|")(1) response.write "您的帖子有人回复了" end if rs1.close set rs1=nothing end sub '用户来源 function address(sip) if isnumeric(left(sip,2)) then set iprs=server.createobject("adodb.recordset") if sip="127.0.0.1" then sip="192.168.0.1" str1=left(sip,instr(sip,".")-1) sip=mid(sip,instr(sip,".")+1) str2=left(sip,instr(sip,".")-1) sip=mid(sip,instr(sip,".")+1) str3=left(sip,instr(sip,".")-1) str4=mid(sip,instr(sip,".")+1) if isNumeric(str1)=0 or isNumeric(str2)=0 or isNumeric(str3)=0 or isNumeric(str4)=0 then else num=cint(str1)*256*256*256+cint(str2)*256*256+cint(str3)*256+cint(str4)-1 ipsql="select Top 1 country,city from address where ip1 <="&num&" and ip2 >="&num&"" iprs.open ipsql,conn,1,1 if iprs.eof and iprs.bof then country="亚洲" city="" else country=iprs("country") city=iprs("city") end if iprs.close set iprs=nothing end if address=country&city else address="未知" end if end function conn.close set conn=nothing %>