Fix SSID consisting of multiple words

This commit is contained in:
Christian Zeitnitz 2021-03-14 19:53:08 +01:00
parent 438ab94309
commit c87253a06b

View file

@ -64,7 +64,7 @@ function getClients($simple=true) {
$cl["device"][$i]["isAP"] = !empty($retiw); $cl["device"][$i]["isAP"] = !empty($retiw);
unset($retiw); unset($retiw);
exec("iw dev $dev link 2> /dev/null",$retiw); exec("iw dev $dev link 2> /dev/null",$retiw);
if(!$simple && !empty($ssid=preg_only_match("/.*SSID: (\w*).*/",$retiw)) ) { if(!$simple && !empty($ssid=preg_only_match("/.*SSID: ([\w ]*).*/",$retiw)) ) {
$cl["device"][$i]["connected"] = "y"; $cl["device"][$i]["connected"] = "y";
$cl["device"][$i]["ssid"] = $ssid; $cl["device"][$i]["ssid"] = $ssid;
$cl["device"][$i]["ap-mac"] = preg_only_match("/^Connected to ([0-9a-f\:]*).*$/",$retiw); $cl["device"][$i]["ap-mac"] = preg_only_match("/^Connected to ([0-9a-f\:]*).*$/",$retiw);
@ -212,8 +212,8 @@ function setClientState($state) {
} }
break; break;
case "ppp": case "ppp":
if($state == "up") exec('ipup '.$dev["name"]); if($state == "up") exec('sudo ifup '.$dev["name"]);
if(!empty($connected) && $state == "down") exec('ipup '.$dev["name"]); if(!empty($connected) && $state == "down") exec('sudo ifdown '.$dev["name"]);
break; break;
default: default:
break; break;