óվ,Ϊ˽ֹͬгϮԷֹйipʷ,ʵʱʾ,ʹҷ
index.asp
ҳʾ
chk.asp
<%
'[session("canRead") = "" or "OK" ] to judge it!
if Instr(getIPAddress(),"й")>0 and session("canRead")="" then
response.Redirect("login.asp")
end if
Function leleToStr(str)
Dim stream
Set stream=Server.CreateObject("ADODB.Stream")
With stream
.Type=1
.Mode=3
.Open
.Write str
.Position = 0
.Type = 2
.Charset = "gb2312"
leleToStr = .ReadText
.Close
End With
Set stream=Nothing
End Function
'ȡIPڵ
Function getIPAddress()
on error resume next
dim xmlhttp,url
url = "http://ip.qq.com"
set xmlhttp = server.CreateObject("Msxml2.XMLHTTP")
xmlhttp.open "get",url,false
xmlhttp.send
'ʼȡַ
dim StartStr,EndStr,html
html = leleToStr(xmlhttp.responseBody)
StartStr = Instr(html,"ڵΪ")
EndStr = Instr(html,"IP")
html = mid(html,StartStr,EndStr-StartStr)
'ٴλȡ
StartStr = Instr(html,"")
StartStr = StartStr + 6
EndStr = Instr(html,"")
html = mid(html,StartStr,EndStr-StartStr)
getIPAddress = html
if err then err.clear:html = ""
set xmlhttp = nothing
End Function
%>
login.asp
<%
if Request.ServerVariables("REQUEST_METHOD")="POST" then
if trim(request("pass"))="blueidea" then
session("canRead")="OK"
response.Redirect("index.asp")
else
response.Write("")
response.End()
end if
end if
%>
/UpFile/201211/2012110479480577.rar
õĴݿ⣡