<% '**************************************************************** ' Two subroutines are provided ' Iptocountry (ipaddress, country, countryname) ' returns country abbreviation for example CA ' and name Canada ' ' ShopCountryUpdate myconn, orderid, ipcountry, ipcountryname ' if the country does notmatch customers country two updates to ther order are made ' ocardtype has country appended Versign CA ' Ipaddress has country appended 555.34.3.99 CANADA ' VP-ASP 6.50 ' March 8, 2004 '********************************************************************** const iptocountrydb="iptocountry" ' const ipdblocation="" ' used for SQL Server const ipdatabasetype="" '******************************************************************* Sub Iptocountry (ipaddress, country, countryname) dim ipnodes(5), ipcount, iipx, dbc, i, ipnumber, rs, rc parserecord ipaddress, ipnodes, ipcount,"." for i = 0 to 3 ipnodes(i)=cdbl(ipnodes(i)) next ipnumber= ipnodes(0)*256*256*256 + ipnodes(1)*256*256 + ipnodes(2)*256 + ipnodes(3) OpenIpDatabase dbc, rc if rc<>0 then exit sub country="???" countryname="???" sql="select * from iptocountry where ipfrom<=" & ipnumber sql=sql & " and ipto>=" & ipnumber set rs=dbc.execute(sqL) if not rs.eof then country=rs("countryshort") countryname=rs("countryname") end if closerecordset rs 'debugwrite " country=" & country & " countryname=" & countryname shopclosedatabase dbc end sub Sub ShopCountryUpdate (myconn, orderid, ipcountry, ipcountryname) dim country, rs, sql, cardtype, ipaddress country=getsess("country") if country=ipcountry then exit sub sql="select * from orders where orderid=" & orderid set rs=myconn.execute(sql) if rs.eof then closerecordset rs exit sub end if cardtype=rs("ocardtype") ipaddress=rs("ipaddress") closerecordset rs cardtype=cardtype& " " & ipcountry ipaddress=Ipaddress & " " & ipcountryname sql="update orders set ocardtype='" & cardtype & "'," sql=sql & " ipaddress='" & ipaddress & "'" sql=sql & " where orderid=" & orderid myconn.execute(sql) end sub Sub openIpdatabase (connection, rc) dim dblocation, database, strconn if ucase(xdatabasetype)="SQLSERVER" or ucase(xdatabasetype)="ODBC" then OpenSpecialdatabase connection, rc else 'VP-ASP 6.50 - broadened defintion of IF statement to cover cases where xmysql hasn't been set if ucase(xdatabasetype) = "MYSQL" OR ucase(xdatabasetype) = "MYSQL351" OR getconfig("xMYSQL")="Yes" then shopopendatabase connection IPCheckDatabaseOpen connection, rc else OpenOtherDatabase connection, Iptocountrydb, xdblocation,xdatabasetype IPCheckDatabaseOpen connection, rc end if end if end sub ' ' for sqlserver, odbc, mysql Sub OpenSpecialdatabase (connection, rc) dim dblocation,strconn, database dblocation=ipdblocation database=iptocountrydb & ".mdb" If dblocation<>"" then database = dblocation & "\" & database end if if ucase(ipdatabasetype)="DRIVE" Then strconn = "provider=Microsoft.ACE.OLEDB.12.0;persist security info=false;data source=" & database else strconn = "provider=Microsoft.ACE.OLEDB.12.0;persist security info=false;data source=" & Server.MapPath(database) end if Set connection = Server.CreateObject("ADODB.Connection") 'debugwrite strconn on error resume next connection.open strConn IPCheckDatabaseOpen upsdbc, rc end sub Sub Ipcheckdatabaseopen (conn, rc) dim msg rc=0 If conn.state=adStateOpen then exit sub msg=getlang("LangDatabaseOpenError") & "
" msg=msg& "
" & getsess("Openerror") shopwriteerror msg rc=4 end sub %>