I have an array like this
var ALLOW_SUBNET = ['192.168.1.', '192.168.2.', '192.168.3.' , '192.168.4.'];
And I can get IP address of PC Client by using my own function:
getIPClient()
var ipclient = input.getIPClient();
My question is how can I check if client IP is within my allowed subnet, I tried to use indexOf() function, but result was wrong. For example:
if IP Client is 192.168.1.115 => allow
if IP Client is 192.168.5.115 => deny.
indexOf()will not work as it matches the entire string!indexOf()works if he remove the last part of the client ip. He is only checking if the subnet is the same and so it could work.