5月7

刚发现个好东东,贴出来下

| |
11:06    ukidhulei 大千世界   From: 本站原创 不指定
           上网的时候发现了这段代码,可以记录蜘蛛的来访,其实也很简单,是分析Http_User_Agent中的数据

     Function里的代码

Function SpiderBot()
        Dim sAgent : sAgent = LCase(Request.ServerVariables("Http_User_Agent"))
        Dim sBot : sBot = ""
        If Instr(sAgent,"googlebot") > 0 Then sBot = "Google"
        If Instr(sAgent,"baiduspider") > 0 Then sBot = "Baidu"
        If Instr(sAgent,"sogou.com") > 0 Then sBot = "Sogou"
        If Instr(sAgent,"yahoo") > 0 Then sBot = "Yahoo!"
        If Instr(sAgent,"msn") > 0 Then sBot = "MSN"
        If Instr(sAgent,"ia_archiver") > 0 Then sBot = "Alexa"
        If Instr(sAgent,"iaarchiver") > 0 Then sBot = "Alexa"
        If Instr(sAgent,"sohu") > 0 Then sBot = "Sohu"
        If Instr(sAgent,"Sqworm") > 0 Then sBot = "AOL"
        If Len(sBot) > 0 Then
                Dim Rs : Set Rs = DB("Select [BotName],[LastDate] From [5U_Bots] Where [BotName]='" & sBot & "'",3)
                If Rs.Eof Then Rs.AddNew : Rs(0) = sBot
                Rs(1) = Now() : Rs.Update : Rs.Close : Set Rs = Nothing
        End If
End Function

     调用页面代码

<%
  j = 1
  Set Rs = DB("Select [BotName],[LastDate] From [5U_Bots] Order By [LastDate] Desc",1)
  Do While Not Rs.Eof
  j = j + 1
  %>
<tr>
    <%For i = 1 To 3%>
    <%If Not Rs.Eof Then%>
    <td><strong><font color=#50691B><%=Rs(0)%></font></strong>  <%=IIF(Month(Rs(1))=Month(Date) And Day(Rs(1))=Day(Date),Rs(1) & " <font color=red size=1>New</font>",Rs(1))%></td>
    <%Else%>
    <td> </td>
    <%End If%>
    <%If Not Rs.Eof Then Rs.MoveNext%>
    <%Next%>
  </tr>
  <%
  If j >=2 Then j = 0
  Loop
  Rs.Close : Set Rs = Nothing
  %>
Tags: ,
阅读(393) | 评论(0) | 引用(0)
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]