diff --git a/html/pages/edituser.php b/html/pages/edituser.php index bfd4b4164..dd2154234 100644 --- a/html/pages/edituser.php +++ b/html/pages/edituser.php @@ -136,10 +136,10 @@ echo("
"); echo(""); echo("

Bill Access

"); - $bill_perm_data = mysql_query("SELECT * from bills AS B, bill_perms AS P WHERE `P.user_id` = '" . $_GET['user_id'] . + $bill_perm_data = mysql_query("SELECT * from bills AS B, bill_perms AS P WHERE P.user_id = '" . $_GET['user_id'] . "' AND P.bill_id = B.bill_id"); - while($bill_perm = mysql_fetch_array($bill_perm_data)) { + while($bill_perm = mysql_fetch_array($bill_perm_data)) { echo("
".$bill_perm['bill_name']."  
"); $bill_access_list[] = $bill_perm['bill_id']; @@ -155,7 +155,7 @@ echo(" + if( interfacepermitted($interface['interface_id']) ) + { + echo(" @@ -48,7 +48,7 @@ while($interface = mysql_fetch_array($query)) { \n"); - $row++; + $row++; } diff --git a/includes/functions.php b/includes/functions.php index cee263922..d3ad6796c 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -117,20 +117,21 @@ function billpermitted($bill_id) { } -function interfacepermitted($interface_id) { - +function interfacepermitted($interface_id) +{ global $_SESSION; if($_SESSION['userlevel'] >= "5") { $allowed = TRUE; } elseif ( devicepermitted(mysql_result(mysql_query("SELECT device_id FROM interface WHERE interface_id = '$interface_id'"),0))) { $allowed = TRUE; - } elseif ( @mysql_result(mysql_query("SELECT count(*) FROM interface_perms WHERE `user_id` = '" . $_SESSION['user_id'] . "' AND `interface_id` = $interface_id"), 0) > '0') { + } elseif ( @mysql_result(mysql_query("SELECT interface_id FROM interfaces_perms WHERE `user_id` = '" . $_SESSION['user_id'] . "' AND `interface_id` = $interface_id"), 0)) { $allowed = TRUE; } else { $allowed = FALSE; } return $allowed; } -function devicepermitted($device_id) { +function devicepermitted($device_id) +{ global $_SESSION; if($_SESSION['userlevel'] >= "5") { $allowed = true; } elseif ( @mysql_result(mysql_query("SELECT * FROM devices_perms WHERE `user_id` = '" . $_SESSION['user_id'] . "' AND `device_id` = $device_id"), 0) > '0' ) { @@ -140,17 +141,20 @@ function devicepermitted($device_id) { } -function formatRates($rate) { +function formatRates($rate) +{ $rate = format_si($rate) . "bps"; return $rate; } -function formatstorage($rate) { +function formatstorage($rate) +{ $rate = format_bi($rate) . "B"; return $rate; } -function format_si($rate) { +function format_si($rate) +{ $sizes = Array('', 'K', 'M', 'G', 'T', 'P', 'E'); $round = Array('0','0','0','2','2','2','2','2','2'); $ext = $sizes[0];
"); - "); $bills = mysql_query("SELECT * FROM `bills` ORDER BY `bill_name`"); while($bill = mysql_fetch_array($bills)) { diff --git a/html/pages/interfaces.php b/html/pages/interfaces.php index 737c3ccfa..e3b235156 100644 --- a/html/pages/interfaces.php +++ b/html/pages/interfaces.php @@ -38,9 +38,9 @@ while($interface = mysql_fetch_array($query)) { $error_img = generateiflink($interface,"Interface Errors",errors); } else { $error_img = ""; } - if( interfacepermitted($interface['interface_id']) ) { - - echo("
" . generatedevicelink($interface) . " " . generateiflink($interface, makeshortif(fixifname($interface['ifDescr']))) . " $error_img $speed" . $interface[ifAlias] . "