Subversion Repositories ALCASAR

Rev

Rev 2304 | Blame | Last modification | View Log

<tr><td colspan="2" align="center"><?= $l_static_dhcp_title ?></td></tr>
<tr><td width="50%" align="center" valign="middle">
        <form action="network.php" method="POST">
        <table cellspacing="2" cellpadding="3" border="1">
        <tr><th><?= $l_mac_address ?></th><th><?= $l_ip_address ?></th><th>Info<th><?= $l_del ?></th></tr>
        <?php
        // Read the "ether" file
        exec('sudo /sbin/ip link show '.escapeshellarg($conf["INTIF"]), $output);
        $detail = explode(' ', $output[1]);
        $intif_mac_addr = strtoupper(str_replace(':', '-', $detail[5]));
        unset($output); unset($detail);
        $line_exist = false;
        $tab = file(ETHERS_INFO_FILE);
        if ($tab) { // le fichier n'est pas vide
                foreach ($tab as $line) {
                        $fields = explode(' ', $line);
                        $mac_addr = $fields[0];
                        $ip_addr  = $fields[1];
                        $info     = (isset($fields[2])) ? $fields[2] : ' ';

                        echo '<tr>';
                        echo "<td>$mac_addr</td>";
                        echo "<td>$ip_addr</td>";
                        if ($mac_addr !== $intif_mac_addr) {
                                echo '<td>'.ltrim($info, '#').'</td>';
                                echo "<td><input type=\"checkbox\" name=\"$mac_addr\"></td>";
                                $line_exist=True;
                        } else {
                                echo '<td>ALCASAR</td>';
                                echo '<td></td>';
                        }
                        echo '</tr>';
                }
        }
        ?>
        </table>
        <?php if ($line_exist): ?>
                <input type="hidden" name="choix" value="del_mac">
                <input type="submit" value="<?= $l_apply ?>">
        <?php endif; ?>
        </form>
</td><td width="50%" valign="middle" align="center">
        <form name="new_mac" action="network.php" method="POST">
                <table cellspacing="2" cellpadding="3" border="1">
                        <tr><th><?= $l_mac_address ?></th><th><?= $l_ip_address ?></th><th>Info</th><td></td></tr>
                        <tr><td>Ex. : 12-2F-36-A4-DF-43</td><td>Ex. : 192.168.182.10</td><td>Ex. : Switch<td></td></tr>
                        <tr><td><input type="text" name="add_mac" size="17"></td>
                        <td><input type="text" name="add_ip" size="10"></td>
                        <td><input type="text" name="info" size="10"></td>
                        <td>
                                <input type="hidden" name="choix" value="new_mac">
                                <input type="submit" class="button" value="<?= $l_add_to_list ?>" onclick="return MAC_Control('new_mac');">
                        </td>
                </tr></table>
        </form>
</td></tr>