Archive: IP Address verification


IP Address verification
Hello everybody,

I have read the validate IP function, usage but i was unable figure out how can installer get the user IP address for validation.

Thanks,

Veeru


Use ValidateIP.


Originally posted by kichik
Use ValidateIP.
Thank you.. Actually i am stuck with how we can push the client IP address to start the validation. In the example Validate IP function will go with validation process. Could you please suggest me how we can retrieve client IP address as an input for validation ?

Thanks.

Why would you want to validate the user's IP? It can't be invalid if you get it through the API.

To get the IP, use one of the following:

http://nsis.sourceforge.net/IP_plug-in
http://nsis.sourceforge.net/Internet_plug-in


[QUOTE]Originally posted by kichik
[B]Why would you want to validate the user's IP?



Can you please explain me about following statement in depth "It can't be invalid if you get it through the API".

Thanks lot.


[QUOTE]Originally posted by kichik
[B]Why would you want to validate the user's IP? It can't be invalid if you get it through the API.

Here i am thinking to give access to installers for the users within our domain and to abort the process if user is not within valid domain range. Please present your comments on the above thought.

Thanks..


The ValidateIP function only checks to make sure a given string is a valid IP. It doesn't check for ranges. If you get the string from a good place (e.g. API), there's no need to validate it.

To make sure the IP is within a given subnet, you'd probably want to split using WordFind, as in ValidateIP, and use IntCmp on each part to make sure it's within the wanted range. You could also convert the IP to a 32-bit integer and use good old masking with IntOp.