对于企业网站的推广来说,百度、谷歌等搜索引擎的频繁光临,能给各位企业网站管理者带来持续网站更新的动力。如何知道百度、谷歌各搜索引擎的光临呢?本站在此有一段代码,可以记录某些搜索光临的时间。
<%
'搜索蜘蛛
dim agent
agent = lcase(request.servervariables("http_user_agent"))
dim Bot: Bot = ""
if instr(agent, "googlebot") > 0 then Bot = "Google"
if instr(agent, "baiduspider") > 0 then Bot = "Baidu"
if instr(agent, "sogou spider") > 0 then Bot = "Sogou"
if instr(agent, "yahoo") > 0 then Bot = "Yahoo!"
if instr(agent, "msn") > 0 then Bot = "MSN"
if instr(agent, "ia_archiver") > 0 then Bot = "Alexa"
if instr(agent, "iaarchiver") > 0 then Bot = "Alexa"
if instr(agent, "sohu") > 0 then Bot = "Sohu"
if instr(agent, "sqworm") > 0 then Bot = "AOL"
if instr(agent, "yodaobot") > 0 then Bot = "Yodao"
if instr(agent, "iaskspider") > 0 then Bot = "Iask"
if len(Bot) > 0 then
set rs = server.CreateObject ("adodb.recordset")
sql="select [Botname],[LastDate] From [Yao_Bots] Where [Botname]='" & Bot & "'"
rs.open sql,conn,1,3
if rs.eof and rs.bof then
rs.AddNew
rs(0) = Bot
rs(1) = now()
else
rs(1) = now()
end if
rs.update
rs.close: set rs = nothing
end if
%>
以上是一段ASP程序,将获得的时间记录于数据库中,南沙网站建设所有客户的网站中,都有此功能,方便大家了解网站对各大搜索引擎的关注度。