<!--#include file="inc/conn.asp"-->
<!--#include file="config.asp"-->
<%
'    @@@@@@ 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 CONN=Server.CreateObject("ADODB.Connection")
CONN.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 = CONN.Execute ( SQL )
If RsIp.bof and RsIp.eof then
UrlCity="未知"
Else
UrlCity=RsIp.Fields.Item("Country").Value
UrlCity1=RsIp.Fields.Item("local").Value
'UrlCity=RsIp(0)&" "&RsIp(1)
If Instr(LCase(UrlCity),""&city&"")<>0 Then
UrlCity=UrlCity & "<img border=0 title='友情提示："&city&"本地信息！' src=../image/note_ok.gif>"
else
UrlCity=UrlCity & "<img border=0 title='友情提示："&city&"地区以外信息！' src=../image/note_error.gif>"
end if
End If
Set Conn = Nothing
RsIp.close
Set RsIp=Nothing
%>
document.write("<%=UrlCity%><%=UrlCity1%>")
