Skip to content
⌘ NSIS Forum Archive

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

7 posts

jaylun#

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
bholliger#
Hi!

Here you are:



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
kichik#
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.
bholliger#
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
kichik#
You're right. It doesn't really validate the IP. I've created ValidateIP which should take care of that.