Then Exit Function Next IsValidIp = True End Function Function GetIPtoCountry(strIP) if len(strIP) = 0 OR (IsNull(strIP)) then strIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR") if strIP = "" Then strIP = Request.ServerVariables("REMOTE_ADDR") end if end if myIP = split(strIP,".") 'Convert dotted IP address into IP number in long IPnumber = (myIp(0)*16777216)+(myIP(1)*65536)+(myIP(2)*256)+(myIP(3)) dbconn = "Provider=SQLOLEDB;Data Source=192.168.100.115;Initial Catalog=feedzilla_live;User Id=dbfz117;Password=telcoven117;Network Library=dbmssocn;" Set Conn2 = Server.CreateObject ("ADODB.Connection") Conn2.open dbConn Set rsf = Server.CreateObject("ADODB.Recordset") sql = "SELECT CTRY FROM ip WHERE IP_FROM <= " & IPnumber & " AND IP_TO >= " & IPnumber rsf.Open sql, conn2, 3,3 if rsf.EOF then strCountry = NULL else strCountry = rsf("CTRY") end if rsf.close set rsf = nothing conn2.close set conn2 = nothing GetIPtoCountry = strCountry End Function 'End Functions %>