Subversion Repositories ALCASAR

Rev

Rev 2304 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
2316 tom.houday 1
<tr><td colspan="2" align="center"><?= $l_static_dhcp_title ?></td></tr>
2
<tr><td width="50%" align="center" valign="middle">
3
	<form action="network.php" method="POST">
4
	<table cellspacing="2" cellpadding="3" border="1">
5
	<tr><th><?= $l_mac_address ?></th><th><?= $l_ip_address ?></th><th>Info<th><?= $l_del ?></th></tr>
6
	<?php
7
	// Read the "ether" file
8
	exec('sudo /sbin/ip link show '.escapeshellarg($conf["INTIF"]), $output);
9
	$detail = explode(' ', $output[1]);
10
	$intif_mac_addr = strtoupper(str_replace(':', '-', $detail[5]));
11
	unset($output); unset($detail);
12
	$line_exist = false;
13
	$tab = file(ETHERS_INFO_FILE);
14
	if ($tab) { // le fichier n'est pas vide
15
		foreach ($tab as $line) {
16
			$fields = explode(' ', $line);
17
			$mac_addr = $fields[0];
18
			$ip_addr  = $fields[1];
19
			$info     = (isset($fields[2])) ? $fields[2] : ' ';
20
 
21
			echo '<tr>';
22
			echo "<td>$mac_addr</td>";
23
			echo "<td>$ip_addr</td>";
24
			if ($mac_addr !== $intif_mac_addr) {
25
				echo '<td>'.ltrim($info, '#').'</td>';
26
				echo "<td><input type=\"checkbox\" name=\"$mac_addr\"></td>";
27
				$line_exist=True;
28
			} else {
29
				echo '<td>ALCASAR</td>';
30
				echo '<td></td>';
31
			}
32
			echo '</tr>';
2265 richard 33
		}
841 richard 34
	}
2316 tom.houday 35
	?>
36
	</table>
37
	<?php if ($line_exist): ?>
38
		<input type="hidden" name="choix" value="del_mac">
39
		<input type="submit" value="<?= $l_apply ?>">
40
	<?php endif; ?>
41
	</form>
42
</td><td width="50%" valign="middle" align="center">
43
	<form name="new_mac" action="network.php" method="POST">
44
		<table cellspacing="2" cellpadding="3" border="1">
45
			<tr><th><?= $l_mac_address ?></th><th><?= $l_ip_address ?></th><th>Info</th><td></td></tr>
46
			<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>
48
			<td><input type="text" name="add_ip" size="10"></td>
49
			<td><input type="text" name="info" size="10"></td>
50
			<td>
51
				<input type="hidden" name="choix" value="new_mac">
52
				<input type="submit" class="button" value="<?= $l_add_to_list ?>" onclick="return MAC_Control('new_mac');">
53
			</td>
54
		</tr></table>
55
	</form>
841 richard 56
</td></tr>