Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 2264 → Rev 2265

/web/acc/admin/network.php
7,7 → 7,7
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
define ("ETHERS_FILE", "/usr/local/etc/alcasar-ethers");
define ("DNS_LOCAL_FILE", "/usr/local/etc/alcasar-dns-name");
$conf_files=array(CONF_FILE,ETHERS_FILE);
$conf_files=array(CONF_FILE,ETHERS_FILE,DNS_LOCAL_FILE);
$reg_ip = '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/';
$reg_ip_cidr = '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$/';
$network_modification=0;
53,7 → 53,6
$l_import = "Importer";
$l_current_certificate = "Certificat actuel";
$l_validated = "Validé par :";
 
} else {
$l_network_title = "Network configuration";
$l_extif_legend = " (Internet connected interface)";
85,7 → 84,6
$l_import = "Import";
$l_current_certificate = "Current certificate";
$l_validated = "Validated by :";
 
}
if (isset($_POST['choix'])){$choix=$_POST['choix'];} else {$choix="";}
switch ($choix)
103,16 → 101,18
if ($tab) # the file isn't empty
{
$insert="True";
$new_mac_addr=trim($_POST['add_mac'],"\x00..\x20");
$new_ip_addr=trim($_POST['add_ip'],"\x00..\x20");
foreach ($tab as $line) # verify that MAC or IP address doesn't exist
{
$field=explode(" ", $line);
$mac_addr=trim($field[0]);$ip_addr=trim($field[1]);
if (strcasecmp(trim($_POST['add_mac']),trim($mac_addr)) == 0)
if (strcasecmp($new_mac_addr, $mac_addr) == 0)
{
$insert="False";
break;
}
if (strcasecmp(trim($_POST['add_ip']), trim($ip_addr)) == 0)
if (strcasecmp($new_ip_addr, $ip_addr) == 0)
{
$insert="False";
break;
120,7 → 120,7
}
if ($insert == "True")
{
$line = trim($_POST['add_mac']) . " " . trim($_POST['add_ip']) . "\n";
$line = $new_mac_addr . " " . $new_ip_addr . " #" . trim($_POST['info'],"\x00..\x20") . "\n";
$pointeur=fopen(ETHERS_FILE,"a");
fwrite ($pointeur, $line);
fclose ($pointeur);
415,7 → 415,7
echo "<tr><th>$l_host_name<th>$l_ip_address";
?>
<td></td></tr>
<tr><td>exemple : my_nas</td><td>exemple : 192.168.182.10</td><td></td></tr>
<tr><td>Ex. : my_nas</td><td>Ex. : 192.168.182.10</td><td></td></tr>
<tr><td><input type='text' name='add_host' size='17'></td>
<td><input type='text' name='add_ip' size='10'><input type='hidden' name='choix' value='new_host'></td>
<td><? echo "<input type=submit class=button value=\"$l_add_to_list\">"?></td>
/web/acc/admin/network2.php
4,7 → 4,7
echo "<tr><td align='center' valign='middle'>";
echo "<FORM action='network.php' method='POST'>";
echo "<table cellspacing=2 cellpadding=3 border=1>";
echo "<tr><th>$l_mac_address<th>$l_ip_address<th>$l_del</tr>";
echo "<tr><th>$l_mac_address<th>$l_ip_address<th>Info<th>$l_del</tr>";
// Read the "ether" file
$intif = $conf["INTIF"];
exec ("sudo /sbin/ip link show $intif", $output);
14,38 → 14,46
$line_exist=False;
$tab=file(ETHERS_FILE);
if ($tab) # le fichier n'est pas vide
{
foreach ($tab as $line)
{
foreach ($tab as $line)
{
$field=explode(" ", $line);
$mac_addr=$field[0];
$ip_addr=$field[1];
if (isset($field[2])) $info=$field[2];
else $info=" ";
echo "<tr><td>$mac_addr";
echo "<td>$ip_addr";
if ($mac_addr != $intif_mac_addr)
{
{
echo "<td>" . ltrim($info,'#');
echo "<td><input type='checkbox' name='$mac_addr'>";
$line_exist=True;
}
else echo "<td>";
}
else
{
echo "<td>ALCASAR";
echo "<td>";
}
echo "</tr>";
}
}
}
echo "</table>";
if ($line_exist)
{
{
echo "<input type='hidden' name='choix' value='del_mac'>";
echo "<input type='submit' value='$l_apply'>";
}
}
echo "</form></td><td valign='middle' align='center'>";
echo "<FORM name='new_mac' action='network.php' method='POST'>";
echo "<table cellspacing=2 cellpadding=3 border=1>";
echo "<tr><th>$l_mac_address<th>$l_ip_address";
echo "<tr><th>$l_mac_address<th>$l_ip_address<th>Info";
?>
<td></td></tr>
<tr><td>exemple : 12-2F-36-A4-DF-43</td><td>exemple : 192.168.182.10</td><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'><input type='hidden' name='choix' value='new_mac'></td>
<td><input type='text' name='info' size='10'></td>
<td><? echo "<input type=submit class=button value=\"$l_add_to_list\" OnClick=\"return MAC_Control('new_mac');\">"?></td>
</tr></table>
</form>