Support
HOME > Support

Support

$val ){ if ( strlen($val) != 3 or is_numeric($val) == false ) { $result = false; } } } return $result; } function ipv4Breakout2 ($ip_address, $ip_nmask) { //convert ip addresses to long form $ip_address_long = ip2long($ip_address); $ip_nmask_long = ip2long($ip_nmask); //caculate network address $ip_net = $ip_address_long & $ip_nmask_long; //caculate first usable address $ip_host_first = ((~$ip_nmask_long) & $ip_address_long); $ip_first = ($ip_address_long ^ $ip_host_first) + 1; //caculate last usable address $ip_broadcast_invert = ~$ip_nmask_long; $ip_last = ($ip_address_long | $ip_broadcast_invert) - 1; //caculate broadcast address $ip_broadcast = $ip_address_long | $ip_broadcast_invert; //Output $ip_net_short = long2ip($ip_net); $ip_first_short = long2ip($ip_first); $ip_last_short = long2ip($ip_last); $ip_broadcast_short = long2ip($ip_broadcast); $block_info = array(array("network" => $ip_net_short), array("first_host" => $ip_first_short), array("last_host" => $ip_last_short), array("broadcast" => $ip_broadcast_short), $hosts); //print_r($block_info); return $block_info; } //print_r($_POST); if ( $_POST["calc"] == "Calculate" ) { $ip_address = trim($_POST["ipa"]); $ip_nmask = trim($_POST["sbn"]); if ( ip_validate($ip_address) == true and ip_validate($ip_nmask) == true ) { $subnets = ipv4Breakout2 ($ip_address, $ip_nmask); echo "[Results]
"; echo "Network:".$subnets[0]["network"]."
"; echo "First Host:".$subnets[1]["first_host"]."
"; echo "Last Host:".$subnets[2]["last_host"]."
"; echo "Broadcast:".$subnets[3]["broadcast"]."


"; } else { echo "[Input Error]
"; } if ( ip_validate($ip_address) == false ) { echo "IP Address is invalid.
"; } if ( ip_validate($ip_nmask) == false ) { echo "Subnet Mask is invalid.
"; } } /** include("./class/SubnetCalculator.php"); $subnet = new SubnetCalculator("173.164.246.201",29); $report = $subnet->getSubnetArrayReport(); print_r($report); **/ ?>

SubnetCalculator
IP Address[xxx.xxx.xxx.xxx]
SubnetMask[255.255.255.xxx]

Pagetop

Support

Contact us at Devicenet USA, Inc. TEL: (408)557-0413 FAX: (408)557-0414 4000 MOORPARK AVE.,  #116 SAN JOSE, CA 95117Inquiry Form


Devicenet USA, Inc. 4000 Moorpark ave., #116 San Jose, CA 95117
Tel: (408) 557-0413 Fax: (408) 557-0414 E-mail: info@devicenet-usa.com

© Devicenet USA, Inc.
URLFhttp://www.devicenet-usa.com