From a0e227e70377a00766424db993618f62c76de387 Mon Sep 17 00:00:00 2001 From: mad Date: Wed, 15 Aug 2018 18:24:29 +0200 Subject: [PATCH] no drive and no cdrom option --- web/index.php | 36 ++++++++++++++++++++++++++---------- web/nlvmi.js | 3 +-- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/web/index.php b/web/index.php index 25eacd7..56bce10 100644 --- a/web/index.php +++ b/web/index.php @@ -7,20 +7,20 @@ function clean($str) { return $str; } if(isset($_REQUEST['logout'])){ -session_start(); -session_unset(); -session_destroy(); + session_start(); + session_unset(); + session_destroy(); } else { -session_start(); + session_start(); } $mode=""; function checkvm($vmname) { -$shellout = shell_exec("/usr/bin/wrap-nlvmi checkvm $vmname bla");//){ - if (preg_match_all('/running/', $shellout)){ - return 0; - } -return 1; + $shellout = shell_exec("/usr/bin/wrap-nlvmi checkvm $vmname bla");//){ + if (preg_match_all('/running/', $shellout)){ + return 0; + } + return 1; } //read config file @@ -92,10 +92,11 @@ if ($usersfound=="no"){ } } +//delete vms if (isset($_SESSION['username'])){ if ((isset($_POST['deletevm']))&&(isset($_POST['deletename']))){ if($_SESSION['isadmin']!=1){ - echo "you are not allowed to change usernames!"; + echo "you are not allowed to delete vms!"; } else { $vmname = clean($_POST['deletename']); $vmid = clean($_POST['deletevm']); @@ -213,6 +214,7 @@ if (isset($_SESSION['username'])){ echo $shellout; } } +//stop vm if (isset($_REQUEST['stop'])){ $vmname = clean($_REQUEST['stop']); if($_SESSION['isadmin']!="1"){ @@ -269,6 +271,18 @@ if (isset($_SESSION['username'])){ echo "d"; echo ""; // echo "$arrColnames[$col]
"; + } elseif ($arrColnames[$col] == "user"){ + if ($val=="") { + $val=$_SESSION['username']; + } + echo "
user
"; } elseif ($arrColnames[$col] == "arch"){ echo "
arch