user limit

This commit is contained in:
mad 2018-08-15 17:00:23 +02:00
parent b458cc9f8b
commit 33fd6621a2
1 changed files with 7 additions and 2 deletions

View File

@ -353,10 +353,15 @@ if (isset($_SESSION['username'])){
} }
if(($mode!="newvm")&&($mode!="editvm")&&($mode!='usermgmt')){ if(($mode!="newvm")&&($mode!="editvm")&&($mode!='usermgmt')){
if ($_SESSION['isadmin']=="1"){
$sqllimit="";
echo "</br><a class=\"btn btn-primary\" href=# onclick=\"post('?', {newvm: 'newvm'});\">Create a new VM</a></br></br>"; echo "</br><a class=\"btn btn-primary\" href=# onclick=\"post('?', {newvm: 'newvm'});\">Create a new VM</a></br></br>";
} else {
$sqllimit="WHERE user='$_SESSION[username]'";
}
//getting vms from DB //getting vms from DB
$sql="SELECT * FROM vms"; $sql="SELECT * FROM vms $sqllimit";
$res = $db_handle->query($sql); $res = $db_handle->query($sql);
echo "<div class=row>"; echo "<div class=row>";
while ($row = $res->fetchArray(SQLITE3_ASSOC)){ while ($row = $res->fetchArray(SQLITE3_ASSOC)){