<%
'    @@@@@@ www.jl-e.com @@@@@@@@@@@@@@@@@
'   @                                        @
'  @                                          @
'  @      吉林信息网，服务百姓生活      @
'  @                                          @
'   @                                        @
'    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
%>

<%



clientip=request("ip")
If clientip ="" Then 
clientip = Request.ServerVariables("REMOTE_ADDR")
'else
'clientip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
end if


Function getIpvalue(clientIP)'得到客户端 的IP转换成长整型，返回值getIpvalue
On Error Resume Next
Dim strIp,array_Ip
strIp=0
array_Ip = Split(clientIP,".")
If UBound(array_Ip)<>3 Then
getIpvalue=0
Exit Function
End If
For i=0 To 3
strIp=strIp+(CInt(array_Ip(i))*(256^(3-i)))
Next
'getIpvalue=strIp-1
getIpvalue=strIp
If Err Then getIpvalue=0

End Function 
Set Connip=Server.CreateObject("ADODB.Connection")
Connip.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&Server.Mappath("data/IP.mdb")
IpValue=getIpvalue(clientIP)
SQL = "SELECT * FROM [IP] WHERE StartIP<=" & IpValue & " AND EndIP>=" & IpValue
'Sql="select * from [IP]  where "&IpValue&" between StartIP and EndIP"
Set RsIp = Connip.Execute ( SQL )
If RsIp.bof and RsIp.eof then
UrlCity="未知"
Else
UrlCity=RsIp.Fields.Item("Country").Value
'UrlCity=RsIp(0)&" "&RsIp(1)
if areas="1" then
If Instr(LCase(UrlCity),""&area1&"")<>0 or Instr(LCase(UrlCity),""&area2&"")<>0 or Instr(LCase(UrlCity),""&area3&"")<>0  or Instr(LCase(UrlCity),""&area4&"")<>0   or Instr(LCase(UrlCity),""&area5&"")<>0 Then
else
'Response.Write "<script language='javascript'>alert('为了保证网站信息真实度及本地化,本站只接受广东"&city&","&area1&","&area2&","&area3&","&area5&"等地区IP发布,广告联系QQ:"&qqa&"！');history.back();</script>"
'response.redirect "/index.asp"
response.redirect "err/ipcheck.asp"
end if
end if
End If
Set Connip = Nothing
RsIp.close
Set RsIp=Nothing
%>

