no drive and no cdrom option

This commit is contained in:
mad 2018-08-15 18:24:29 +02:00
parent 29502222f6
commit a0e227e703
2 changed files with 27 additions and 12 deletions

View File

@ -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 "<a class=dropdown-item href=\"javascript:dropdown('bootoptionbutton','d')\">d</a>";
echo "</div></div></div></div><input type=hidden id=bootoptionbuttonh name=bootoption value=c>";
// echo "$arrColnames[$col] <select name=bootoption><option value=c>C</option><option value=d>D</option></select></br>";
} elseif ($arrColnames[$col] == "user"){
if ($val=="") {
$val=$_SESSION['username'];
}
echo "<div class=row><div class=col-md-1 style=text-align:right>user</div><div class=col-md-2><div class=dropdown><button class=\"btn btn-secondary dropdown-toggle\" type=button id=userbutton data-toggle=dropdown aria-haspopup=true aria-expanded=false>$val</button>";
echo "<div class=dropdown-menu aria-labelledby=userbutton>";
$sqlusers="SELECT username FROM users";
$resusers=$db_handle->query($sqlusers);
while ($rowusers = $resusers->fetchArray(SQLITE3_ASSOC)){
echo "<a class=dropdown-item href=\"javascript:dropdown('userbutton','$rowusers[username]')\">$rowusers[username]</a>";
}
echo "</div></div></div><input type=hidden id=userbuttonh name=user value=$_SESSION[username]></div>";
} elseif ($arrColnames[$col] == "arch"){
echo "<div class=row><div class=col-md-1 style=text-align:right>arch</div><div class=col-md-2><div class=dropdown><button class=\"btn btn-secondary dropdown-toggle\" type=button id=archbutton data-toggle=dropdown aria-haspopup=true aria-expanded=false>x86_64</button>";
echo "<div class=dropdown-menu aria-labelledby=archbutton>";
@ -278,6 +292,7 @@ if (isset($_SESSION['username'])){
} elseif ($arrColnames[$col] == "cdrom"){
echo "<div class=row><div class=col-md-1 style=text-align:right>cdrom</div><div class=col-md-2><div class=dropdown><button class=\"btn btn-secondary dropdown-toggle\" type=button id=cdrombutton data-toggle=dropdown aria-haspopup=true aria-expanded=false>$val</button>";
echo "<div class=dropdown-menu aria-labelledby=cdrombutton>";
echo "<a class=dropdown-item href=\"javascript:dropdown('cdrombutton','')\">no cdrom</a><div class=dropdown-divider></div>";
$isodirs = explode('|', $config['ISODIRECTORY']);
foreach($isodirs as $isodir){
$files = array_diff(scandir($isodir), array('.', '..'));
@ -300,6 +315,7 @@ if (isset($_SESSION['username'])){
} elseif (preg_match('/drive/', $arrColnames[$col])){
echo "<div class=row><div class=col-md-1 style=text-align:right>$arrColnames[$col]</div><div class=col-md-2><div class=dropdown><button class=\"btn btn-secondary dropdown-toggle\" type=button id=$arrColnames[$col]button data-toggle=dropdown aria-haspopup=true aria-expanded=false>$val</button>";
echo "<div class=dropdown-menu aria-labelledby=$arrColnames[$col]button>";
echo "<a class=dropdown-item href=\"javascript:dropdown('$arrColnames[$col]button','')\">no disk</a><div class=dropdown-divider></div>";
$vmdirs = explode('|', $config['VMDIRECTORY']);
foreach($vmdirs as $vmdir){
$files = array_diff(scandir($vmdir), array('.', '..'));

View File

@ -50,8 +50,7 @@ $('#confirm-delete').on('show.bs.modal', function(e) {
function submitbutton(formid){
console.log(formid);
data = $('#'+ formid).serialize();
console.log(data);
// data: 'who='+ who +'&what='+ what,
console.log(data);
$.ajax({
type: 'POST',
url: "?rand="+ makeid(),