<%
function plus_var(pvar,pt)
  plus_var="yes"
  if instr(1,pvar,".")>1 or instr(1,pvar,"-")>0 then plus_var="no"
end function

sub web_above()
  dim ttt,ntt,user_ip,user_sys,user_sys2,rs,sql,wt,login_id
  user_ip=objv7.ip_sys(1,0):user_sys=objv7.ip_sys(3,0)
  wt=int(mid(web_setup,3,1))
  
  user_sys2=trim(lcase(user_sys))
  if instr(user_sys2,"teleport")>0 or instr(user_sys2,"webzip")>0 or instr(user_sys2,"flashget")>0 or instr(user_sys2,"offline")>0 then
    if isobject(rs) then set rs=nothing
    call close_conn()
    response.write "<title>"&objv7.web_var(web_config,1)&","&objv7.web_var(web_config,2)&"</title>" & _
		   objv7.web_var(web_config,1)&" "&objv7.web_var(web_config,2)&" <br><br>" & _
		   "非法操作：请不要使用WebZip、Teleport这类软件下载本站，也不要使用googlebot这类浏览器浏览本站。<br><br>" & _
		   "请更改操作或浏览器后再访问本站。谢谢！"
    set objv7=nothing
    response.end
  end if
  
  if web_login=1 and index_url<>"error" then
    if symbol_name(login_username)<>"yes" or symbol_ok(login_password)<>"yes" then
      login_mode="":login_username="":login_password=""
    else
      sql="select id,power,popedom,emoney,integral from user_data where hidden=1 and username='"&login_username&"' and password='"&login_password&"'"
      set rs=conn.execute(sql)
      if rs.eof and rs.bof then
        login_mode="":login_username="":login_password=""
        response.Cookies(web_cookies)("login_username")=""
        response.Cookies(web_cookies)("login_password")=""
      else
        login_id=rs("id"):login_popedom=rs("popedom"):login_mode=rs("power")
        login_emoney=rs("emoney")
        conn.execute("update user_data set last_tim='"&now_time&"' where id="&login_id)
      end if
      rs.close
    end if

    '完整型,用户和游客都进行识别,这里识别游客
    if wt=1 and login_mode="" then
      ttt=trim(request.cookies(web_cookies)("guest_name"))
      set rs=conn.execute("select l_id from user_login where l_username='"&ttt&"'")
      if rs.eof and rs.bof then
        ntt="游客"&Session.SessionID
        conn.execute("insert into user_login(l_username,l_type,l_where,l_tim_login,l_tim_end,l_ip,l_sys) values('"&ntt&"',1,'"&tit&"','"&now_time&"','"&now_time&"','"&user_ip&"','"&user_sys&"')")
        response.cookies(web_cookies)("guest_name")=ntt
      else
        conn.execute("update user_login set l_where='"&tit&"',l_tim_end='"&now_time&"' where l_id="&rs("l_id"))
      end if
      rs.close
    end if
    
    if (wt=1 or wt=2) and login_mode<>"" then
      sql="select count(*) from user_mail where accept_u='"&login_username&"' and types=1 and isread=0"
      if plus_var(login_username,1)<>"yes" then sql="select count(*) from user_mail where accept_u='"&login_username&"' and types=1 and isread=0"
      set rs=conn.execute(sql)
      login_message=int(rs(0))
      rs.close
      sql="select l_id,l_ip from user_login where l_username='"&login_username&"'"
      set rs=conn.execute(sql)
      if rs.eof and rs.bof then
        conn.execute("insert into user_login(l_username,l_type,l_where,l_tim_login,l_tim_end,l_ip,l_sys) values('"&login_username&"',0,'"&tit&"','"&now_time&"','"&now_time&"','"&user_ip&"','"&user_sys&"')")
        conn.execute("update user_login set l_where='"&tit&"',l_tim_end='"&now_time&"' where l_username='"&login_username&"'")

      rs.close
      response.cookies(web_cookies)("guest_name")=""
    end if
end if
    
    set rs=conn.execute("select count(l_id) from user_login")
    if not(rs.eof and rs.bof) then online_num=rs(0)
    rs.close:set rs=nothing
    if wt<>1 and login_mode="" then online_num=online_num+1
    counter_s=counter_type("view","no")
    
    '---------------------------------Access 2000----------------------------------
    sql="delete from user_login where DateDiff('n',l_tim_end,now())>"&int(objv7.web_var(web_num,13))
    'sql="delete from user_login where l_tim_end<"&DateAdd("n",-"&int(objv7.web_var(web_num,13))&",now())
    conn.execute(sql)
    
    response.cookies(web_cookies)("login_mode")=login_mode
    call cookies_yes()
  end if
end sub
%>