⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 counter.asp

📁 一个java源程序用于气泡法的java
💻 ASP
字号:
<!--#include file="include.asp"-->
<%
 dim sql,rs,user
 dim date_now,hits,ip_address,url
 dim visit_date,path,full
 dim hidden

 user=trim(request("user"))

 if user<>empty then

 date_now=now()
 call del_data()
 
 ip_address=request.servervariables("REMOTE_ADDR")
 url=request.servervariables("HTTP_REFERER")
 if len(url)>100 then url=left(url,100)&"..."
 hidden=trim(request("hidden"))
 
 sql="select * from cnt_info where user01='"&user&"' and ip_address='"&ip_address&"'"
 set rs=conn.execute(sql)

 if rs.eof then
  
  sql="insert into cnt_info (user01,hits,ip_address,url,vi_date) values "
  sql=sql&"('"&user&"',1,'"&ip_address&"','"&url&"','"&date_now&"')"
  conn.execute(sql) 
    
  sql="update cnt_msg set count01=count01+1,ip_hits=ip_hits+1,today_count=today_count+1,today_ip=today_ip+1 where user01='"&user&"'" 
  conn.execute(sql)
  
 else

   sql="update cnt_info set hits=hits+1,vi_date='"&date_now&"',url='"&url&"' where user01='"&user&"' and ip_address='"&ip_address&"'"
   conn.execute(sql)
   sql="update cnt_msg set count01=count01+1,today_count=today_count+1 where user01='"&user&"'" 
   conn.execute(sql) 
 end if

if hidden<>"1" then 

 sql="select * from cnt_msg where user01='"&user&"'"
 set rs=conn.execute(sql)

 number=cstr(rs("count01"))
 if len(number)<6 then
  i=6-len(number)
  str2=string(i,"0")
  number=str2&number
 end if
  
 for i=1 to len(number)
  number2="cn"&mid(number,i,1)&".gif"
  path=rs("path")&"/images/"&number2
  full=full&"<img src="&path&" border=0 alt=点此查看统计信息>"
 next 
  
 full="<a href="&rs("path")&"/message.asp?user="&user&" target=_blank>"&full&"</a>"
 response.write "document.write('"&full&"');"

 end if

rs.close()
conn.close()
set conn=nothing
set rs=nothing 

end if
%>

<%
function del_data()

 now_date=datevalue(date_now)

 sql="select * from cnt_msg where user01='"&user&"'"
 set rs=conn.execute(sql)

 if not rs.eof then

  visit_date=rs("last_vi")

  if datediff("d",visit_date,now_date)<>0 then 

   y_cnt=clng(rs("today_count"))
   y_ip=clng(rs("today_ip"))
   start_date=datevalue(rs("start_date"))

   days=datediff("d",start_date,now_date)
   if days>1 then
    av_count=fix(clng(rs("count01"))/days)
    av_ip=fix(clng(rs("ip_hits"))/days)
    sql="update cnt_msg set av_count="&av_count&",av_ip="&av_ip&" where user01='"&user&"'"
    conn.execute(sql)
   end if
   
   sql="update cnt_msg set yd_count="&y_cnt&",yd_ip="&y_ip&",today_count=0,today_ip=0,last_vi='"&now_date&"' where user01='"&user&"'"
   conn.execute(sql)
  
   sql="insert into cnt_history (user01,date01,ip_num,vi_num) values "
   sql=sql&"('"&user&"','"&visit_date&"',"&y_ip&","&y_cnt&")"
   conn.execute(sql)

   sql="delete cnt_info where user01='"&user&"'"
   conn.execute(sql)

  end if

 end if

end function
%>

⌨️ 快捷键说明

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