autostart and stopall for host reboot

This commit is contained in:
nativemad
2018-10-10 20:23:40 +02:00
parent 2619e9b411
commit 1d5834298b
2 changed files with 83 additions and 33 deletions

View File

@@ -287,6 +287,13 @@ if (isset($_SESSION['username'])){
exit;
}
}
if ($rkey == "autostart"){
if ($rvalue == "on"){
$rvalue = "1";
} else {
$rvalue = "0";
}
}
$rvalue = clean($_REQUEST[$rkey]);
if ($rvalue == "x86_64"){
$rvalue = "qemu-system-x86_64";
@@ -308,6 +315,7 @@ if (isset($_SESSION['username'])){
exit;
} elseif ($_REQUEST['mode']=="editvm"){
$sql="UPDATE vms SET ";
$autostartfound = "0";
foreach(array_keys($_REQUEST) as $rkey){
if (($rkey!="mode")&&($rkey!="editid")&&($rkey!="rand")){
$rvalue = clean($_REQUEST[$rkey]);
@@ -318,6 +326,14 @@ if (isset($_SESSION['username'])){
exit;
}
}
if ($rkey == "autostart"){
$autostartfound = "1";
if ($rvalue == "on"){
$rvalue = "1";
} else {
$rvalue = "0";
}
}
if ($rvalue == "x86_64"){
$rvalue = "qemu-system-x86_64";
} elseif ((preg_match('/no drive/', $rvalue))||($rvalue == "no cdrom")){
@@ -326,7 +342,11 @@ if (isset($_SESSION['username'])){
$sql .= " $rkey='$rvalue',";
}
}
$sql = rtrim($sql, ',');
if ($autostartfound == "0"){
$sql .= " autostart='0'";
} else {
$sql = rtrim($sql, ',');
}
$eid=clean($_REQUEST['editid']);
$sql .= " WHERE id='$eid'";
$res = $db_handle->exec($sql);