22,19 → 22,20 |
exit("Can't read the file ".$file);} |
} |
#retrieve IP_address of ALCASAR |
$alcasar_conf_file="/usr/local/etc/alcasar.conf"; |
$ouvre=fopen("$alcasar_conf_file","r"); |
if ($ouvre){ |
while (!feof ($ouvre)) |
{ |
$tampon = fgets($ouvre, 4096); |
if (strpos($tampon,"=")!==false){ |
$tmp = explode("=",$tampon); |
$conf[$tmp[0]] = $tmp[1]; |
} |
$alcasar_conf_file = '/usr/local/etc/alcasar.conf'; |
$file_conf = fopen($alcasar_conf_file, 'r'); |
if (!$file_conf) { |
exit('Error opening the file '.$alcasar_conf_file); |
} |
while (!feof($file_conf)) { |
$buffer = fgets($file_conf, 4096); |
if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) { |
$tmp = explode('=', $buffer); |
$conf[trim($tmp[0])] = trim($tmp[1]); |
} |
} |
fclose($ouvre); |
fclose($file_conf); |
|
$tmp = explode("/",$conf["PRIVATE_IP"]); |
$intif = $conf["INTIF"]; |
$private_ip=$tmp[0]; |
78,16 → 79,16 |
if (isset($_POST['action'])){ |
switch ($_POST['action']){ |
case "$l_disconnect" : |
exec ("sudo /usr/sbin/chilli_query logout $_POST[mac_addr]"); |
unset ($_POST['mac_addr']); |
exec("sudo /usr/sbin/chilli_query logout ".escapeshellarg($_POST['mac_addr'])); |
unset($_POST['mac_addr']); |
break; |
case "$l_dissociate" : |
exec ("sudo /usr/sbin/chilli_query dhcp-release $_POST[mac_addr]"); |
unset ($_POST['mac_addr']); |
exec("sudo /usr/sbin/chilli_query dhcp-release ".escapeshellarg($_POST['mac_addr'])); |
unset($_POST['mac_addr']); |
break; |
case "$l_connect" : |
exec ("sudo /usr/sbin/chilli_query authorize mac $_POST[mac_addr]"); |
unset ($_POST['mac_addr']); |
exec("sudo /usr/sbin/chilli_query authorize mac ".escapeshellarg($_POST['mac_addr'])); |
unset($_POST['mac_addr']); |
break; |
} |
} |
103,7 → 104,7 |
<th>$l_action</th> |
</tr>"; |
$output = array(); $detail = array(); $nb_ligne = 0; |
exec ("sudo /sbin/ip link show $intif", $output); // retrieve ALCASAR MAC address |
exec("sudo /sbin/ip link show ".escapeshellarg($intif), $output); // retrieve ALCASAR MAC address |
$detail = explode (" " , $output[1]); |
$intif_mac_addr=strtoupper(str_replace(":","-",$detail[5])); |
unset ($output);unset ($detail); |