Archive: how can I check the IP address the user inputs is correct ??


how can I check the IP address the user inputs is correct ??
the setup needs the user inputs the ip of the server,i can save the ip the user inputs to Var $R0,but i don't know how to check the ip fomat is correct


You can use CheckIP.


Hi!

Here you are:

http://nsis.sourceforge.net/Docs/AppendixE.html#E.3.16

VersionCompare YourIP 1.1.1.1 $var ; $var=1 Version1 is newer
- and -
VersionCompare YourIP 255.255.255.255 $var ; $var=2 Version2 is newer

might be a solution.

Cheers

Bruno


That won't work because 1.1.1.500 is "newer" than 1.1.1.1, but "older" than 255.255.255.255 and it's still invalid.


Hi!

As far as I can see CheckIP considers everything else than LanIP, APA or Loopback as an internet address. There's no validation.

Do you agree?

Cheers

Bruno


You're right. It doesn't really validate the IP. I've created ValidateIP which should take care of that.


Hi!

Perfect. Thank you very much!

Cheers

Bruno