Title: dotted IP number to IP number
Has anyone used <http://ip-to-country.com/> to greet people by country.  (If this works our marketing people will love it!)

Using URL tag  <@URL LOCATION="http://ip-to-country.com/get-country/?ip=<@CGIPARAM CLIENT_IP>&user=guest&password=guest">  I find out I am in Switzerland cool !

To speed things up I set up a local database as described on the site, but before it will work I need to get the non-dotted IP Number.

And this doesn't seem to work.

Any ideas?

<@ASSIGN NAME="ip_array" VALUE="<@TOKENIZE VALUE='<@CGIPARAM CLIENT_IP>' CHARS='.'>" SCOPE="request">

<@ASSIGN NAME="ipNUMBER" VALUE="
<@CALC EXPR='
<@VAR ip_array[1, 1] SCOPE=Request> * (256 * 256 *256)
+
<@VAR ip_array[1, 2] SCOPE=Request> * (256 * 256)
+
<@VAR ip_array[1, 3] SCOPE=Request> * 256
+
<@VAR ip_array[1, 4] SCOPE=Request>
'>
" SCOPE="request">

@@request$ip_array  <@comment> my dotted ip number in 1 x 4 array - OK </@comment>

<br>

@@request$ipNUMBER  <@comment> a number which is not in the database - Not OK </@comment>

<br>

 <@comment> just to make sure lets print out the dotted number again </@comment>

<@VAR ip_array[1, 1] SCOPE=Request>.<@VAR ip_array[1, 2] SCOPE=Request>.<@VAR ip_array[1, 3] SCOPE=Request>.<@VAR ip_array[1, 4] SCOPE=Request>

Server Mac OS X 10.2.6
Witango  5.0.1.058

And there maybe a bug as <@CGIPARAM CLIENT_IP> is returning the servers IP Number.

dan
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf

Reply via email to