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> |