| Line 2... |
Line 2... |
| 2 |
<?
|
2 |
<?
|
| 3 |
echo "$l_static_dhcp_title</td></tr>";
|
3 |
echo "$l_static_dhcp_title</td></tr>";
|
| 4 |
echo "<tr><td align='center' valign='middle'>";
|
4 |
echo "<tr><td align='center' valign='middle'>";
|
| 5 |
echo "<FORM action='network.php' method='POST'>";
|
5 |
echo "<FORM action='network.php' method='POST'>";
|
| 6 |
echo "<table cellspacing=2 cellpadding=3 border=1>";
|
6 |
echo "<table cellspacing=2 cellpadding=3 border=1>";
|
| 7 |
echo "<tr><th>$l_mac_address<th>$l_ip_address<th>$l_del</tr>";
|
7 |
echo "<tr><th>$l_mac_address<th>$l_ip_address<th>Info<th>$l_del</tr>";
|
| 8 |
// Read the "ether" file
|
8 |
// Read the "ether" file
|
| 9 |
$intif = $conf["INTIF"];
|
9 |
$intif = $conf["INTIF"];
|
| 10 |
exec ("sudo /sbin/ip link show $intif", $output);
|
10 |
exec ("sudo /sbin/ip link show $intif", $output);
|
| 11 |
$detail = explode (" " , $output[1]);
|
11 |
$detail = explode (" " , $output[1]);
|
| 12 |
$intif_mac_addr=strtoupper(str_replace(":","-",$detail[5]));
|
12 |
$intif_mac_addr=strtoupper(str_replace(":","-",$detail[5]));
|
| 13 |
unset ($output);unset ($detail);
|
13 |
unset ($output);unset ($detail);
|
| 14 |
$line_exist=False;
|
14 |
$line_exist=False;
|
| 15 |
$tab=file(ETHERS_FILE);
|
15 |
$tab=file(ETHERS_FILE);
|
| 16 |
if ($tab) # le fichier n'est pas vide
|
16 |
if ($tab) # le fichier n'est pas vide
|
| 17 |
{
|
17 |
{
|
| 18 |
foreach ($tab as $line)
|
18 |
foreach ($tab as $line)
|
| 19 |
{
|
19 |
{
|
| 20 |
$field=explode(" ", $line);
|
20 |
$field=explode(" ", $line);
|
| 21 |
$mac_addr=$field[0];
|
21 |
$mac_addr=$field[0];
|
| 22 |
$ip_addr=$field[1];
|
22 |
$ip_addr=$field[1];
|
| - |
|
23 |
if (isset($field[2])) $info=$field[2];
|
| - |
|
24 |
else $info=" ";
|
| 23 |
echo "<tr><td>$mac_addr";
|
25 |
echo "<tr><td>$mac_addr";
|
| 24 |
echo "<td>$ip_addr";
|
26 |
echo "<td>$ip_addr";
|
| 25 |
if ($mac_addr != $intif_mac_addr)
|
27 |
if ($mac_addr != $intif_mac_addr)
|
| 26 |
{
|
28 |
{
|
| - |
|
29 |
echo "<td>" . ltrim($info,'#');
|
| 27 |
echo "<td><input type='checkbox' name='$mac_addr'>";
|
30 |
echo "<td><input type='checkbox' name='$mac_addr'>";
|
| 28 |
$line_exist=True;
|
31 |
$line_exist=True;
|
| 29 |
}
|
- |
|
| 30 |
else echo "<td>";
|
- |
|
| 31 |
echo "</tr>";
|
- |
|
| 32 |
}
|
32 |
}
|
| - |
|
33 |
else
|
| - |
|
34 |
{
|
| - |
|
35 |
echo "<td>ALCASAR";
|
| - |
|
36 |
echo "<td>";
|
| - |
|
37 |
}
|
| - |
|
38 |
echo "</tr>";
|
| 33 |
}
|
39 |
}
|
| - |
|
40 |
}
|
| 34 |
echo "</table>";
|
41 |
echo "</table>";
|
| 35 |
if ($line_exist)
|
42 |
if ($line_exist)
|
| 36 |
{
|
43 |
{
|
| 37 |
echo "<input type='hidden' name='choix' value='del_mac'>";
|
44 |
echo "<input type='hidden' name='choix' value='del_mac'>";
|
| 38 |
echo "<input type='submit' value='$l_apply'>";
|
45 |
echo "<input type='submit' value='$l_apply'>";
|
| 39 |
}
|
46 |
}
|
| 40 |
echo "</form></td><td valign='middle' align='center'>";
|
47 |
echo "</form></td><td valign='middle' align='center'>";
|
| 41 |
echo "<FORM name='new_mac' action='network.php' method='POST'>";
|
48 |
echo "<FORM name='new_mac' action='network.php' method='POST'>";
|
| 42 |
echo "<table cellspacing=2 cellpadding=3 border=1>";
|
49 |
echo "<table cellspacing=2 cellpadding=3 border=1>";
|
| 43 |
echo "<tr><th>$l_mac_address<th>$l_ip_address";
|
50 |
echo "<tr><th>$l_mac_address<th>$l_ip_address<th>Info";
|
| 44 |
?>
|
51 |
?>
|
| 45 |
<td></td></tr>
|
52 |
<td></td></tr>
|
| 46 |
<tr><td>exemple : 12-2F-36-A4-DF-43</td><td>exemple : 192.168.182.10</td><td></td></tr>
|
53 |
<tr><td>Ex. : 12-2F-36-A4-DF-43</td><td>Ex. : 192.168.182.10</td><td>Ex. : Switch<td></td></tr>
|
| 47 |
<tr><td><input type='text' name='add_mac' size='17'></td>
|
54 |
<tr><td><input type='text' name='add_mac' size='17'></td>
|
| 48 |
<td><input type='text' name='add_ip' size='10'><input type='hidden' name='choix' value='new_mac'></td>
|
55 |
<td><input type='text' name='add_ip' size='10'><input type='hidden' name='choix' value='new_mac'></td>
|
| - |
|
56 |
<td><input type='text' name='info' size='10'></td>
|
| 49 |
<td><? echo "<input type=submit class=button value=\"$l_add_to_list\" OnClick=\"return MAC_Control('new_mac');\">"?></td>
|
57 |
<td><? echo "<input type=submit class=button value=\"$l_add_to_list\" OnClick=\"return MAC_Control('new_mac');\">"?></td>
|
| 50 |
</tr></table>
|
58 |
</tr></table>
|
| 51 |
</form>
|
59 |
</form>
|
| 52 |
</td></tr>
|
60 |
</td></tr>
|
| 53 |
</table>
|
61 |
</table>
|