Subversion Repositories ALCASAR

Rev

Rev 2304 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

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