<%function ipsource(sip)
dim iprs,ipsql,ipconn,ipconnstr
	
	if isnumeric(left(sip,2)) then
	if sip="127.0.0.1" then sip="192.168.0.1"
	str1=left(sip,instr(sip,".")-1)
	sip=mid(sip,instr(sip,".")+1)
	str2=left(sip,instr(sip,".")-1)
	sip=mid(sip,instr(sip,".")+1)
	str3=left(sip,instr(sip,".")-1)
	str4=mid(sip,instr(sip,".")+1)
	if isNumeric(str1)=0 or isNumeric(str2)=0 or isNumeric(str3)=0 or isNumeric(str4)=0 then

	else
    num=cint(str1)*256*256*256+cint(str2)*256*256+cint(str3)*256+cint(str4)-1
	ipconnstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("data/ip.asp")
	Set ipconn = Server.CreateObject("ADODB.Connection")
	ipconn.Open ipconnstr
	set iprs=server.createobject("adodb.recordset")
	ipsql="select Top 1 country,city from address where ip1 <="&num&" and ip2 >="&num&""
	iprs.open ipsql,ipconn,1,1
		if iprs.eof and iprs.bof then 
		country="ÑÇÖÞ"
		city=""
		else
		country=iprs("country")
		city=iprs("city")
		end if
	iprs.close
	set iprs=nothing
	ipconn.close
	set ipconn=nothing
	end if
	ipsource=country&city
	else
	ipsource="Î´Öª"
	end if
end function


Function GetIp(IP)
	ips=Split(ip,".")
	GetIp=ips(0)&"."&ips(1)&".*.*"
end Function
%>