<!--#include file="SiteConfig.Asp" -->

<%
'蜘蛛主程序
function spiderbot()

		Dim Txcomcom_Url,GetLocationURL
		Dim ServerPort,ServerName,ScriptName,QueryString,Txcomcom_Ip
		ServerName = Request.ServerVariables("SERVER_NAME")       '获取服务器IP
		ServerPort = Request.ServerVariables("SERVER_PORT")       '服务器处理请求的端口
		ScriptName = Request.ServerVariables("SCRIPT_NAME")       '执行脚本的名称
		QueryString = Request.ServerVariables("QUERY_STRING")      '查询字符串内容
		Txcomcom_Ip = Request.ServerVariables("REMOTE_ADDR")           '获取访问IP
		Txcomcom_Url="http://"&ServerName 
		If ServerPort <> "80" Then Txcomcom_Url = Txcomcom_Url & ":" & ServerPort     '判断端口是否为80，如果不是就填上端口号
		Txcomcom_Url=Txcomcom_Url&ScriptName 
		If QueryString <>"" Then Txcomcom_Url=Txcomcom_Url&"?"& QueryString           '判断所访问的地址是否带有参数
		GetLocationURL=Txcomcom_Url 
		
		dim agent: agent = lcase(request.servervariables("http_user_agent"))   '获取返回内容并赋值
		dim Txcomcom_Bot: Txcomcom_Bot = ""
		if instr(agent, "Txcomcom_Bot") > 0 then Txcomcom_Bot = "其它蜘蛛"
		if instr(agent,"googlebot") then Txcomcom_Bot="Google"                   '从返回值中判断是什么蜘蛛
		if instr(agent, "mediapartners-google") > 0 then Txcomcom_Bot = "Google Adsense"
		if instr(agent, "baiduspider") > 0 then Txcomcom_Bot = "Baidu"
		if instr(agent, "360spider") > 0 then Txcomcom_Bot = "360"
		if instr(agent, "sogou spider") > 0 then Txcomcom_Bot = "Sogou"
		if instr(agent, "yahoo") > 0 then Txcomcom_Bot = "Yahoo!"
		if instr(agent, "msn") > 0 then Txcomcom_Bot = "MSN"
		if instr(agent, "ia_archiver") > 0 then Txcomcom_Bot = "Alexa"
		if instr(agent, "iaarchiver") > 0 then Txcomcom_Bot = "Alexa"
		if instr(agent, "sohu") > 0 then Txcomcom_Bot = "Sohu"
		if instr(agent, "sqworm") > 0 then Txcomcom_Bot = "AOL"
		if instr(agent, "yodaobot") > 0 then Txcomcom_Bot = "Yodao"
		if instr(agent, "iaskspider") > 0 then Txcomcom_Bot = "Iask"
		if len(Txcomcom_Bot) > 0 then
		
		 Dim dbPath, adOpenDynamic, adLockPessimistic,TxcomcomSql,NumT          '把数据写入数据库
		 TxcomcomSql="select * from bot_main  Where Txcomcom_Bot='" & Txcomcom_Bot & "' and Txcomcom_Url like '%"&GetLocationURL&"%' order by txcomcom_id asc " 
		 TxcomcomRs.open TxcomcomSql, TxcomcomConn,1,3
		 if TxcomcomRs.recordcount>3 then 
		 for NumT=1 to TxcomcomRs.recordcount-3
		 TxcomcomRs.delete
		 TxcomcomRs.movenext
		 next
		 end if
		 if not TxcomcomRs.eof then TxcomcomRs.movelast
		 if TxcomcomRs.recordcount<>0 then 
		 if TxcomcomRs("txcomcom_visitime") <> now()  then TxcomcomRs.AddNew
		 else
		 TxcomcomRs.AddNew
		 end if
		 TxcomcomRs("Txcomcom_Bot") = Txcomcom_Bot
		 TxcomcomRs("txcomcom_visitime") = now()
		 TxcomcomRs("Txcomcom_Url") = GetLocationURL
		 TxcomcomRs("Txcomcom_Ip") = Txcomcom_Ip
		 TxcomcomRs.Update
		 TxcomcomRs.Close
         Set TxcomcomRs = Nothing 
		 end if
end function




%>