WEB开发网
开发学院WEB开发ASP Asp统计各搜索系统的蜘蛛排行 阅读

Asp统计各搜索系统的蜘蛛排行

 2009-04-22 10:38:26 来源:WEB开发网   
核心提示:<%'网页立即超时,防止漏统计Response.Expires = 0'客户端软件使用情况Bot="no"thesoft=Request.ServerVariables("HTTP_USER_AGENT")thesoft2=lcase(thesoft)if

<%
'网页立即超时,防止漏统计
Response.Expires = 0

'客户端软件使用情况
Bot="no"
thesoft=Request.ServerVariables("HTTP_USER_AGENT")
thesoft2=lcase(thesoft)
if instr(thesoft2,"bot") then Bot="其它蜘蛛"
if instr(thesoft2,"googlebot") then
     Bot="Google蜘蛛B"
     if instr(thesoft2,"mozilla") then Bot="Google蜘蛛A"
end if
if instr(thesoft2,"baidu spider") then Bot="百度蜘蛛"
if instr(thesoft2,"msnbot") then Bot="微软蜘蛛"
if instr(thesoft2,"inktomi") then Bot="inktomi蜘蛛"
if instr(thesoft2,"openbot") then Bot="openbot蜘蛛"
if instr(thesoft2,"Alexa robot") then Bot="Alexa蜘蛛"
if instr(thesoft2,"yahoo-mmcrawler") then Bot="yahoo蜘蛛"
if instr(thesoft2,"survey") then Bot="Survey蜘蛛"


vyear=year(now())
vmonth=right("0" & month(now()),2)
vday=right("0" & day(now()),2)
MyDay=vyear&vmonth&vday

now2=now()-1
vyear2=year(now2)
vmonth2=right("0" & month(now2),2)
vday2=right("0" & day(now2),2)
MyDay2=vyear2&vmonth2&vday2

if Bot<>"no" then
     dim vip
     '****************** 记录相关数据 ******************
     '被访问页面
     vpage="http://"&Request.ServerVariables("HTTP_HOST")&Request.ServerVariables("URL")

   'IP
     vip=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
     If vip="" Then vip = Request.ServerVariables("REMOTE_ADDR")


     '****************** 写主数据 ******************
     Dim fso,f1,cnrs
     MyFilePath=server.MapPath("log/data/log"&MyDay&".htm")

   Set fso = Server.CreateObject("Scripting.FileSystemObject")

   if not fso.FileExists(MyFilePath) then
         Set f1 = fso.CreateTextFile(MyFilePath , True)
         f1.close
         Set fso = Server.CreateObject("Scripting.FileSystemObject")
         NewFile="yes"
     end if

   set cnrs=fso.OpenTextFile(MyFilePath,8,True)
         if NewFile="yes" then

TmpStr="<style>a {text-decoration: none};p {font-size:9pt};td {font-size:9pt};select {font-size:9pt};</style>"
TmpStr20=TmpStr
cnrs.WriteLine(TmpStr)

TmpStr="<p align=center><font color=#008000><b><a href=http://Log.GoogleDmoz.com target=_blank>"
TmpStr=TmpStr&"蜘蛛来访统计</a> <a href=log"&MyDay2&".htm>[昨日"&MyDay2&"]</a> <a href=log"&MyDay&".htm>[今日"&MyDay&"]</a></font></p>"
TmpStr21=TmpStr
cnrs.WriteLine(TmpStr)
'www.cncms.com

TmpStr="<table width=957 border=1> <tr><td width=72>来访时间</td>"
TmpStr=TmpStr&"<td width=158>蜘蛛类型</td>"
TmpStr=TmpStr&"<td width=95>来路IP</td>"
TmpStr=TmpStr&"<td width=594>被访页面</td></tr>"
TmpStr22=TmpStr
cnrs.WriteLine(TmpStr)
         end if

       if len(vip)<1 then vip="未知"

       dot=""
         if len(vpage)>80 then dot="..."
         if len(vpage)<1 then dot="未知"
         dot2=""
         if len(vcome)>80 then dot2="..."
         if len(vcome)<1 then dot2="无"

TmpStr="<tr><td width=72>"&now&"</td>"
TmpStr=TmpStr&"<td width=158>"&Bot&"</td>"
TmpStr=TmpStr&"<td width=95>----</td>"
TmpStr=TmpStr&"<td width=594><a href="&vpage&" target=_blank>"&vpage&dot&"</a></td></tr>"
cnrs.WriteLine(TmpStr)

   cnrs.Close


     '****************** 写主数据2 ******************
     NewFile=""
     Dim fso2,f12,cnrs2
     MyFilePath2=server.MapPath("log/datame/log"&MyDay&".htm")

   Set fso2 = Server.CreateObject("Scripting.FileSystemObject")

   if not fso2.FileExists(MyFilePath2) then
         Set f12 = fso2.CreateTextFile(MyFilePath2 , True)
         f12.close
         Set fso2 = Server.CreateObject("Scripting.FileSystemObject")
         NewFile="yes"
     end if

   set cnrs2=fso2.OpenTextFile(MyFilePath2,8,True)
         if NewFile="yes" then


cnrs2.WriteLine(TmpStr20)

cnrs2.WriteLine(TmpStr21)

cnrs2.WriteLine(TmpStr22)
         end if


TmpStr="<tr><td width=72>"&now&"</td>"
TmpStr=TmpStr&"<td width=158>"&thesoft&"</td>"
TmpStr=TmpStr&"<td width=95>"&vip&"</td>"
TmpStr=TmpStr&"<td width=594><a href="&vpage&" target=_blank>"&vpage&dot&"</a></td></tr>"
cnrs2.WriteLine(TmpStr)

   cnrs2.Close
end if
%>

Tags:Asp 统计 搜索

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接