My system includes a third party box that stores IP addresses and compares them to values sent from my Web interface. I have a problem that a user entered the netmask for the third party box as 255.255.255.000, and the box stored it as 255.255.255.0. However the next time the box reboots and is told that the mask includes 000 it concludes that these values are different and updates its database and reboots. And reboots. And reboots.
My intent is to solve this by storing the netmask in my own system in the simplified form 255.255.255.0 (and as another example store 010.001.002.005 as 10.1.2.5). But I'm brand new to PHP. I tried code $mask = long2ip(ip2long($mask))
to convert the entry to a standardized form but just got back 0.0.0.0. Is there something special I need to do to convert the IP to long and back? Is there a better way to simplify this?