22,7 → 22,15 |
$l_trusted_sites_explain2 = "Entrez un nom de domaine ou une adresse IP par ligne"; |
$l_trusted_sites_list = "Liste de nom de domaine de confiance"; |
$l_trusted_urls_list = "Liste d'adresses IP ou d'adresses de réseau de confiance"; |
$l_trusted_mac = "Équipements de confiance"; |
$l_trusted_mac_explain = "Entrez ici les adresses MAC des équipements autorisés à joindre Internet sans authentification"; |
$l_trusted_mac_list = "Liste d'adresses MAC de confiance"; |
$l_trusted_mac_address = "Adresses MAC autorisées"; |
$l_trusted_mac_info = "Information équipement"; |
$l_trusted_mac_del = "Supprimer de la liste"; |
$l_submit = "Enregistrer"; |
$l_submit2 = "Appliquer"; |
$l_add_to_list = "Ajouter"; |
} |
else { |
$l_error_open_file = "File open error"; |
31,7 → 39,15 |
$l_trusted_sites_explain2 = "Enter one domain name ou one IP address per line"; |
$l_trusted_sites_list = "Trusted Internet domain list"; |
$l_trusted_urls_list = "Trusted IP addresses or networks addresses list"; |
$l_trusted_mac = "Trusted Equipments"; |
$l_trusted_mac_explain = "Enter MAC address of equipments that could contact Internet without authentication"; |
$l_trusted_mac_list = "Trusted MAC addresses list"; |
$l_trusted_mac_address = "Allowed MAC adress"; |
$l_trusted_mac_info = "Equipment information"; |
$l_trusted_mac_del = "Delete from list"; |
$l_submit = "Submit"; |
$l_submit2 = "Apply"; |
$l_add_to_list = "Add"; |
} |
if (isset($_POST['choix'])){ |
switch ($_POST['choix']) |
58,6 → 74,63 |
exec ("sudo service chilli restart"); |
unset ($_POST['choix']); |
break; |
case 'new_mac' : |
if (trim($_POST['add_mac']) != "") |
{ |
if (is_file ($mac_allowed_list)) # le fichier existe |
{ |
$tab=file($mac_allowed_list); |
$insert = true; |
if ($tab) # le fichier n'est pas vide |
{ |
foreach ($tab as $line) # on teste si l'adresse mac n'est pas déjà présente |
{ |
$field=explode("#", $line); |
$mac_addr=trim($field[0],"macallowed="); |
if (trim($_POST['add_mac']) == trim ($mac_addr)) |
{ |
$insert = false;; |
break; |
} |
} |
} |
if ($insert == true) |
{ |
$line = "macallowed=" . trim($_POST['add_mac']) . " #" . trim($_POST['add_comment']) . "\n"; |
$pointeur=fopen($mac_allowed_list,"a"); |
fwrite ($pointeur, $line); |
fclose ($pointeur); |
exec ("sudo service chilli restart"); |
} |
} |
else {echo "$l_error_open_file $mac_allowed_list";} |
} |
break; |
case 'del_mac' : |
$tab=file($mac_allowed_list); |
if ($tab) |
{ |
$pointeur=fopen($mac_allowed_list,"w+"); |
foreach ($tab as $line) |
{ |
$field=explode("#", $line); |
$mac_addr=trim(trim($field[0],"macallowed=")); |
$remove_line = false; |
foreach ($_POST as $key => $value) |
{ |
if ($mac_addr == $key) |
{ |
$remove_line = True; |
break; |
} |
} |
if (! $remove_line) {fwrite($pointeur,$line);} |
} |
fclose($pointeur); |
exec ("sudo service chilli restart"); |
} |
else {echo "$l_error_open_file $mac_allowed_list";} |
break; |
} |
} |
?> |
135,5 → 208,63 |
</td></tr> |
</TABLE> |
</TABLE> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th><?php echo $l_trusted_mac ;?></th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr> |
</TABLE> |
|
<table width="100%" border=1 cellspacing=0 cellpadding=1> |
<tr><td colspan=2 align="center"> |
<? |
echo "$l_trusted_mac_explain</td></tr>"; |
echo "<tr><td align='center' valign='middle'>"; |
echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>"; |
echo "<table cellspacing=2 cellpadding=3 border=1>"; |
echo "<tr><th>$l_trusted_mac_address<th>$l_trusted_mac_info<th>$l_trusted_mac_del</tr>"; |
// On lit et on affiche le fichier d'exception |
$display_form = true; |
if (is_file ($mac_allowed_list)) |
{ |
$tab=file($mac_allowed_list); |
if ($tab) # le fichier n'est pas vide |
{ |
foreach ($tab as $line) |
{ |
$field=explode("#", $line); |
$mac_addr=trim(trim($field[0],"macallowed=")); |
$mac_info=trim($field[1],"#"); |
echo "<tr><td>$mac_addr"; |
echo "<td>$mac_info"; |
echo "<td><input type='checkbox' name='$mac_addr'>"; |
echo "</tr>"; |
} |
} |
else { $display_form = false;} |
} |
else { |
echo "$l_error_open_file $mac_allowed_list"; |
$display_form = false; |
} |
echo "</table>"; |
if ($display_form) |
{ |
echo "<input type='hidden' name='choix' value='del_mac'>"; |
echo "<input type='submit' value='$l_submit2'>"; |
} |
echo "</form></td><td valign='middle' align='center'>"; |
echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>"; |
echo "<table cellspacing=2 cellpadding=3 border=1>"; |
echo "<tr><th>$l_trusted_mac_address<th>$l_trusted_mac_info"; |
?> |
<td></td></tr> |
<tr><td>exemple : 12-2f-36-a4-df-43</td><td>exemple : PC of the boss</td><td></td></tr> |
<tr><td><input type='text' name='add_mac' size='17'></td> |
<td><input type='text' name='add_comment' size='10'></td> |
<input type='hidden' name='choix' value='new_mac'> |
<td><input type='submit' value='<?echo"$l_add_to_list";?>'></td> |
</tr></table> |
</form> |
</td></tr> |
</table> |
</BODY> |
</HTML> |