149,7 → 149,6 |
fclose($file_conf); |
$wifi4eu = $conf['WIFI4EU']; |
$wifi4eu_code = $conf['WIFI4EU_CODE']; |
|
// Doing an action on a service (start,stop or restart) |
function serviceExec($service, $action){ |
if (($action == "start")||($action == "stop")||($action == "restart")){ |
191,7 → 190,11 |
if (isset($_POST['wifi4eu'])){ |
switch ($_POST['wifi4eu']){ |
case 'on' : |
file_put_contents(CONF_FILE, preg_replace('/WIFI4EU_CODE=.*/', 'WIFI4EU_CODE='.trim($_POST['wifi4eu_code']), file_get_contents(CONF_FILE))); |
$network_code = trim($_POST['wifi4eu_id']); |
if ($network_code == '') { |
$network_code = '123e4567-e89b-12d3-a456-426655440000'; // WIFI4EU test code |
} |
file_put_contents(CONF_FILE, preg_replace('/WIFI4EU_CODE=.*/', 'WIFI4EU_CODE='.$network_code, file_get_contents(CONF_FILE))); |
exec("sudo /usr/local/bin/alcasar-wifi4eu.sh -on"); |
break; |
case 'off' : |
335,7 → 338,7 |
<td width="80" align="center">---</td> |
<?php } else { ?> |
<td align="center"><img src="/images/state_error.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ko; ?>"></td> |
<td align="center">WIFI4EU</td><td><?php echo $l_wifi4eu_id; ?> : <input type ="text" name="wifi4eu_code" value="<?php echo $wifi4eu_code; ?>" size="40"></td> |
<td align="center">WIFI4EU</td><td><?php echo $l_wifi4eu_id; ?> : <input type ="text" name="wifi4eu_id" value="<?php echo $wifi4eu_code; ?>" size="40"></td> |
<td width="80" align="center"><input type=submit value="<?echo $l_service_start;?>"><input type=hidden name="wifi4eu" value="on"></td> |
<td width="80" align="center">---</td> |
<td width="80" align="center">---</td> |