Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 860 → Rev 861

/web/acc/admin/network.php
1,35 → 1,19
<?php
/* written by steweb57 & Rexy */
 
/***************************************
* CONSTANTES AVEC CHEMINS DES FICHIERS *
****************************************/
/********************
* TEST CONF FILES *
*********************/
define ("ALCASAR_CHILLI", "/etc/chilli.conf");
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
define ("ETHERS_FILE", "/usr/local/etc/alcasar-ethers");
 
/********************
* TEST DES FICHIERS *
*********************/
//Test de présence et des droits en lecture des fichiers de configuration.
if (!file_exists(ALCASAR_CHILLI)){
exit("Fichier de configuration ".ALCASAR_CHILLI." non présent");
$conf_files=array(ALCASAR_CHILLI,CONF_FILE,ETHERS_FILE);
foreach ($conf_files as $file){
if (!file_exists($file)){
exit("Requested file ".$file." isn't present");}
if (!is_readable($file)){
exit("Can't read the file ".$file);}
}
if (!is_readable(ALCASAR_CHILLI)){
exit("Vous n'avez pas les droits de lecture sur le fichier ".ALCASAR_CHILLI);
}
if (!file_exists(CONF_FILE)){
exit("Fichier de configuration ".CONF_FILE." non présent");
}
if (!is_readable(CONF_FILE)){
exit("Vous n'avez pas les droits de lecture sur le fichier ".CONF_FILE);
}
if (!file_exists(ETHERS_FILE)){
exit("Fichier de configuration ".ETHERS_FILE." non présent");
}
if (!is_readable(ETHERS_FILE)){
exit("Vous n'avez pas les droits de lecture sur le fichier ".ETHERS_FILE);
}
 
# Choice of language
$Language = 'en';
47,17 → 31,19
$l_ip_public = "Adresse IP publique";
$l_ip_dns1 = "DNS1";
$l_ip_dns2 = "DNS2";
$l_dhcp_title = "Serveur DHCP";
$l_dhcp_on = "Le service DHCP est actuellement activé";
$l_dhcp_off = "Le service DHCP est actuellement arrêté";
$l_switch_on = "Démarrer le service DHCP";
$l_switch_off = "Arrêter le service DHCP";
$l_dhcp_title = "Service DHCP";
$l_DHCP_full = "DHCP complet";
$l_DHCP_half = "Demi DHCP ";
$l_DHCP_off = "Sans DHCP";
$l_DHCP_full_explain = "DHCP complet";
$l_DHCP_half_explain = "Demi DHCP ";
$l_DHCP_off_explain = "Sans DHCP";
$l_static_dhcp_title = "Réservation d'adresses IP statiques";
$l_mac_address = "Adresse MAC";
$l_ip_address = "Adresse IP";
$l_mac_del = "Supprimer de la liste";
$l_add_to_list = "Ajouter";
$l_submit = "Appliquer";
$l_apply = "Appliquer les changements";
 
} else {
$l_network_title = "Network configuration";
70,27 → 56,32
$l_ip_public = "Public IP address";
$l_ip_dns1 = "DNS1 :";
$l_ip_dns2 = "DNS2";
$l_dhcp_title = "DHCP server";
$l_dhcp_on = "The DHCP service is enabled";
$l_dhcp_off = "The DHCP service is disabled";
$l_switch_on = "Start the DHCP service";
$l_switch_off = "Stop the DHCP service";
$l_dhcp_title = "DHCP service";
$l_DHCP_full = "Full DHCP";
$l_DHCP_half = "Half DHCP ";
$l_DHCP_off = "No DHCP";
$l_DHCP_full_explain = "Full DHCP";
$l_DHCP_half_explain = "Half DHCP ";
$l_DHCP_off_explain = "No DHCP";
$l_static_dhcp_title = "Static IP addresses reservation";
$l_mac_address = "MAC Address";
$l_ip_address = "IP Address";
$l_mac_del = "Delete from list";
$l_add_to_list = "Add";
$l_submit = "Apply";
$l_apply = "Apply changes";
}
if (isset($_POST['choix'])){$choix=$_POST['choix'];} else {$choix="";}
switch ($choix)
{
case 'DHCP_On' :
exec ("sudo /usr/local/sbin/alcasar-dhcp.sh -on");
case 'DHCP_Full' :
exec ("sudo /usr/local/sbin/alcasar-dhcp.sh -full");
break;
case 'DHCP_Off' :
exec ("sudo /usr/local/sbin/alcasar-dhcp.sh -off");
break;
case 'DHCP_Half' :
exec ("sudo /usr/local/sbin/alcasar-dhcp.sh -half");
break;
case 'new_mac' :
if ((trim($_POST['add_mac']) != "") and (trim($_POST['add_ip']) != ""))
{
182,9 → 173,9
}
fclose($ouvre);
 
/****************************************************************
* Lecture du fichier CONF_FILE *
*****************************************************************/
/***********************************
* Read ALCASAR_CONF_FILE *
************************************/
$ouvre=fopen(CONF_FILE,"r");
if ($ouvre){
while (!feof ($ouvre))
258,25 → 249,22
<table width="100%" border=1 cellspacing=0 cellpadding=0>
<tr><td valign="middle" align="left">
<?
if (strncmp ($conf["DHCP"],"on",2) == 0)
{
echo "<CENTER><H3>$l_dhcp_on</H3></CENTER>";
echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
echo "<input type=hidden name='choix' value=\"DHCP_Off\">";
echo "<input type=submit value=\"$l_switch_off\">";
}
else
{
echo "<CENTER><H3>$l_dhcp_off</H3></CENTER>";
echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
echo "<input type=hidden name='choix' value=\"DHCP_On\">";
echo "<input type=submit value=\"$l_switch_on\">";
}
$dhcp_state=trim($conf["DHCP"]);
echo "<CENTER><H3>${"l_DHCP_".$dhcp_state}</H3></CENTER>";
echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
echo "<select name='choix'>";
echo "<option value=\"DHCP_Off\" ";if (!strcmp($dhcp_state,"off")) echo "selected";echo ">$l_DHCP_off";
echo "<option value=\"DHCP_Half\" ";if (!strcmp($dhcp_state,"half")) echo "selected";echo ">$l_DHCP_half";
echo "<option value=\"DHCP_Full\" ";if (!strcmp($dhcp_state,"full")) echo "selected";echo ">$l_DHCP_full";
echo "</select>";
echo "<input type=submit value='$l_apply'>";
echo "<td align='center'>";
echo "$l_DHCP_off : $l_DHCP_off_explain<br>$l_DHCP_half : $l_DHCP_half_explain<br>$l_DHCP_full : $l_DHCP_full_explain";
echo "</td>";
echo "</FORM>";
echo "</td></tr>";
echo "</TABLE>";
if (strncmp($conf["DHCP"],"on",2) == 0) require ('network2.php');
if (strncmp($conf["DHCP"],"full",2) == 0) { require ('network2.php');}
else { echo "</TABLE>"; }
?>
</BODY>
</body>
</html>
/web/acc/admin/net_filter.php
39,7 → 39,7
$l_proto="Nom du protocole";
$l_enabled="Autoris&eacute;";
$l_add_to_list="Ajouter &agrave; la liste";
$l_save_modif="Enregistrer les modifications";
$l_save="Enregistrer les modifications";
}
else {
$l_title_antivir = "WEB antivirus";
68,7 → 68,7
$l_proto="protocol name";
$l_enabled="Authorized";
$l_add_to_list="Add to the list";
$l_save_modif="Save modifications";
$l_save="Save changes";
}
/********************
* TEST CONF FILES *
83,6 → 83,23
if (!is_readable($file)){
exit("Can't read the file ".$file);}
}
/**********************************
* Read ALCASAR CONF_FILE *
***********************************/
$ouvre=fopen(CONF_FILE,"r");
if ($ouvre){
while (!feof ($ouvre))
{
$tampon = fgets($ouvre, 4096);
if (strpos($tampon,"=")!==false){
$tmp = explode("=",$tampon);
$conf[$tmp[0]] = $tmp[1];
}
}
}else{
exit("Erreur d'ouverture du fichier ".CONF_FILE);
}
fclose($ouvre);
 
if (isset($_POST['choix'])){$choix=$_POST['choix'];} else {$choix="";}
switch ($choix)
304,7 → 321,11
echo ">";}
else {
echo "checked>";}
echo "<td><input type='checkbox' name='del-$ip_addr'>";
echo "<td>";
if (strcmp (trim($ip_addr),trim($conf["PUBLIC_IP"]))) {
echo "<input type='checkbox' name='del-$ip_addr'>";}
else {
echo "&nbsp;";}
echo "</tr>";
}
}
312,7 → 333,7
?>
</table>
<input type='hidden' name='choix' value='change_ip'>
<input type='submit' value='<?echo"$l_save_modif";?>'>
<input type='submit' value='<?echo"$l_save";?>'>
</form></td><td valign='middle' align='center'>
<form action='<?echo"$_SERVER[PHP_SELF]"?>' method='POST'>
<table cellspacing=2 cellpadding=3 border=1>
/web/acc/admin/network2.php
1,4 → 1,3
<table width="100%" border=1 cellspacing=0 cellpadding=1>
<tr><td colspan=2 align="center">
<?
echo "$l_static_dhcp_title</td></tr>";
27,7 → 26,7
if ($line_exist)
{
echo "<input type='hidden' name='choix' value='del_mac'>";
echo "<input type='submit' value='$l_submit'>";
echo "<input type='submit' value='$l_apply'>";
}
echo "</form></td><td valign='middle' align='center'>";
echo "<FORM action='network.php' method='POST'>";
44,5 → 43,3
</form>
</td></tr>
</table>
</BODY>
</HTML>
/web/acc/admin/net_filter2.php
20,7 → 20,11
echo ">";}
else {
echo "checked>";}
if ($name_svc != "icmp") {echo "<td><input type='checkbox' name='del-$name_svc'>";}
echo "<td>";
if ($name_svc != "icmp") {
echo "<input type='checkbox' name='del-$name_svc'>";}
else {
echo "&nbsp;";}
echo "</tr>";
}
}
28,7 → 32,7
?>
</table>
<input type='hidden' name='choix' value='change_port'>
<input type='submit' value='<?echo"$l_save_modif";?>'>
<input type='submit' value='<?echo"$l_save";?>'>
</form></td><td valign='middle' align='center'>
<form action='net_filter.php' method='POST'>
<table cellspacing=2 cellpadding=3 border=1>