1 | <?php
|
---|
2 | // Testing /src/inc/Network.class.php
|
---|
3 |
|
---|
4 | require_once('../inc/Network.class.php');
|
---|
5 |
|
---|
6 | $ip1 = '172.16.0.245';
|
---|
7 | $ip2 = '172.16.0.246';
|
---|
8 | $ip3 = '172.16.0.249';
|
---|
9 | $network1 = new Network($ip1, 30);
|
---|
10 | $network2 = new Network($ip2, 30);
|
---|
11 | $network3 = new Network($ip3, 30);
|
---|
12 | echo '
|
---|
13 | Address: ' . $ip1 . ' / ' . Network::binIP($ip1) . '<br/>
|
---|
14 | Netmask: ' . $network1->netmaskDecimal . ' / ' . $network1->netmaskBinary . '<br/>
|
---|
15 | Wildcard: ' . $network1->wildcardDecimal . ' / ' . $network1->wildcardBinary . '<br/>
|
---|
16 | Network: ' . $network1->networkDecimal . ' / ' . $network1->networkBinary . '<br/>
|
---|
17 | Broadcast: ' . $network1->broadcastDecimal . ' / ' . $network1->broadcastBinary . '<br/>
|
---|
18 | HostMin: ' . $network1->hostminDecimal . ' / ' . $network1->hostminBinary . '<br/>
|
---|
19 | HostMax: ' . $network1->hostmaxDecimal . ' / ' . $network1->hostmaxBinary . '<br/>
|
---|
20 | Hosts/Net: ' . $network1->numberHosts . '<br/>
|
---|
21 | <br/>
|
---|
22 | Address: ' . $ip2 . ' / ' . Network::binIP($ip2) . '<br/>
|
---|
23 | Netmask: ' . $network2->netmaskDecimal . ' / ' . $network2->netmaskBinary . '<br/>
|
---|
24 | Wildcard: ' . $network2->wildcardDecimal . ' / ' . $network2->wildcardBinary . '<br/>
|
---|
25 | Network: ' . $network2->networkDecimal . ' / ' . $network2->networkBinary . '<br/>
|
---|
26 | Broadcast: ' . $network2->broadcastDecimal . ' / ' . $network2->broadcastBinary . '<br/>
|
---|
27 | HostMin: ' . $network2->hostminDecimal . ' / ' . $network2->hostminBinary . '<br/>
|
---|
28 | HostMax: ' . $network2->hostmaxDecimal . ' / ' . $network2->hostmaxBinary . '<br/>
|
---|
29 | Hosts/Net: ' . $network2->numberHosts . '<br/>
|
---|
30 | <br/>
|
---|
31 | Address: ' . $ip3 . ' / ' . Network::binIP($ip3) . '<br/>
|
---|
32 | Netmask: ' . $network3->netmaskDecimal . ' / ' . $network3->netmaskBinary . '<br/>
|
---|
33 | Wildcard: ' . $network3->wildcardDecimal . ' / ' . $network3->wildcardBinary . '<br/>
|
---|
34 | Network: ' . $network3->networkDecimal . ' / ' . $network3->networkBinary . '<br/>
|
---|
35 | Broadcast: ' . $network3->broadcastDecimal . ' / ' . $network3->broadcastBinary . '<br/>
|
---|
36 | HostMin: ' . $network3->hostminDecimal . ' / ' . $network3->hostminBinary . '<br/>
|
---|
37 | HostMax: ' . $network3->hostmaxDecimal . ' / ' . $network3->hostmaxBinary . '<br/>
|
---|
38 | Hosts/Net: ' . $network3->numberHosts . '<br/>
|
---|
39 | <br/>
|
---|
40 | Compare network 1 by network 1: ' . $network1->compare($network1) . '<br/>
|
---|
41 | Compare network 1 by network 2: ' . $network1->compare($network2) . '<br/>
|
---|
42 | Compare network 1 by network 3: ' . $network1->compare($network3) . '<br/>
|
---|
43 | Compare network 2 by network 1: ' . $network2->compare($network1) . '<br/>
|
---|
44 | Compare network 2 by network 2: ' . $network2->compare($network2) . '<br/>
|
---|
45 | Compare network 2 by network 3: ' . $network2->compare($network3) . '<br/>
|
---|
46 | Compare network 3 by network 1: ' . $network3->compare($network1) . '<br/>
|
---|
47 | Compare network 3 by network 2: ' . $network3->compare($network2) . '<br/>
|
---|
48 | Compare network 3 by network 3: ' . $network3->compare($network3) . '<br/>
|
---|
49 | <br/>
|
---|
50 | Check if IP 1 is in network 1: ' . $network1->inNetwork($ip1) . '<br/>
|
---|
51 | Check if IP 2 is in network 1: ' . $network1->inNetwork($ip2) . '<br/>
|
---|
52 | Check if IP 3 is in network 1: ' . $network1->inNetwork($ip3) . '<br/>
|
---|
53 | Check if IP 1 is in network 2: ' . $network2->inNetwork($ip1) . '<br/>
|
---|
54 | Check if IP 2 is in network 2: ' . $network2->inNetwork($ip2) . '<br/>
|
---|
55 | Check if IP 3 is in network 2: ' . $network2->inNetwork($ip3) . '<br/>
|
---|
56 | Check if IP 1 is in network 3: ' . $network3->inNetwork($ip1) . '<br/>
|
---|
57 | Check if IP 2 is in network 3: ' . $network3->inNetwork($ip2) . '<br/>
|
---|
58 | Check if IP 3 is in network 3: ' . $network3->inNetwork($ip3) . '<br/>';
|
---|
59 | ?>
|
---|