";
if ($row['admin']=="1"){
@@ -196,7 +202,11 @@ if (isset($_SESSION['username'])){
//start vm
if (isset($_REQUEST['start'])){
$vmname = clean($_REQUEST['start']);
- $sql="SELECT * FROM vms WHERE vmname='$vmname'";
+ $sqllimit="";
+ if($_SESSION['isadmin']!="1"){
+ $sqllimit="WHERE username='$_SESSION[username]'";
+ }
+ $sql="SELECT * FROM vms WHERE vmname='$vmname' $sqllimit";
$res = $db_handle->query($sql);
while ($row = $res->fetchArray(SQLITE3_ASSOC)){
$shellout = shell_exec("/usr/bin/wrap-nlvmi start $vmname bla");
@@ -205,7 +215,10 @@ if (isset($_SESSION['username'])){
}
if (isset($_REQUEST['stop'])){
$vmname = clean($_REQUEST['stop']);
- $sql="SELECT * FROM vms WHERE vmname='$vmname'";
+ if($_SESSION['isadmin']!="1"){
+ $sqllimit="WHERE username='$_SESSION[username]'";
+ }
+ $sql="SELECT * FROM vms WHERE vmname='$vmname' $sqllimit";
$res = $db_handle->query($sql);
while ($row = $res->fetchArray(SQLITE3_ASSOC)){
if(checkvm($vmname)){
@@ -331,8 +344,9 @@ if (isset($_SESSION['username'])){
$sqlv = rtrim($sqlv, ',');
$sqlv.=")";
$sql = "$sqls$sqlc$sqlv";
- echo $sql;
+ //echo $sql;
$result = $db_handle->exec($sql);
+ $mode="";
} elseif ($_REQUEST['mode']=="editvm"){
$mode="editvm";
$sql="UPDATE vms SET ";
@@ -372,13 +386,14 @@ if (isset($_SESSION['username'])){
$button = "stop";
$buttonc = "btn-warning";
}
- echo "
$row[vmname]
edit ";
+ echo "
$row[vmname]
edit ";
echo "
$button ";
echo "
";
$server = gethostname();
if (preg_match('/stop/', $button)) {
echo "
VNC";
}
+ echo "
";
}
}
echo "