"); if ($_SESSION['userlevel'] != '10') { include("includes/error-no-perm.inc.php"); } else { if ($_GET['user_id']) { $user_data = mysql_fetch_assoc(mysql_query("SELECT * FROM users WHERE user_id = '" . $_GET['user_id'] . "'")); echo("

" . $user_data['realname'] . "

Change...

"); // Perform actions if requested if ($_GET['action'] == "deldevperm") { if (mysql_result(mysql_query("SELECT COUNT(*) FROM devices_perms WHERE `device_id` = '" . $_GET['device_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"),0)) { mysql_query("DELETE FROM devices_perms WHERE `device_id` = '" . $_GET['device_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"); } } if ($_GET['action'] == "adddevperm") { if (!mysql_result(mysql_query("SELECT COUNT(*) FROM devices_perms WHERE `device_id` = '" . $_GET['device_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"),0)) { mysql_query("INSERT INTO devices_perms (`device_id`, `user_id`) VALUES ('" . $_GET['device_id'] . "', '" . $_GET['user_id'] . "')"); } } if ($_GET['action'] == "delifperm") { if (mysql_result(mysql_query("SELECT COUNT(*) FROM ports_perms WHERE `interface_id` = '" . $_GET['interface_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"),0)) { mysql_query("DELETE FROM ports_perms WHERE `interface_id` = '" . $_GET['interface_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"); } } if ($_GET['action'] == "addifperm") { if (!mysql_result(mysql_query("SELECT COUNT(*) FROM ports_perms WHERE `interface_id` = '" . $_GET['interface_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"),0)) { mysql_query("INSERT INTO ports_perms (`interface_id`, `user_id`) VALUES ('" . $_GET['interface_id'] . "', '" . $_GET['user_id'] . "')"); } } if ($_GET['action'] == "delbillperm") { if (mysql_result(mysql_query("SELECT COUNT(*) FROM bill_perms WHERE `bill_id` = '" . $_GET['bill_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"),0)) { mysql_query("DELETE FROM bill_perms WHERE `bill_id` = '" . $_GET['bill_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"); } } if ($_GET['action'] == "addbillperm") { if (!mysql_result(mysql_query("SELECT COUNT(*) FROM bill_perms WHERE `bill_id` = '" . $_GET['bill_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"),0)) { mysql_query("INSERT INTO bill_perms (`bill_id`, `user_id`) VALUES ('" . $_GET['bill_id'] . "', '" . $_GET['user_id'] . "')"); } } echo("
"); // Display devices this users has access to echo("

Device Access

"); $device_perm_data = mysql_query("SELECT * from devices_perms as P, devices as D WHERE `user_id` = '" . $_GET['user_id'] . "' AND D.device_id = P.device_id"); while ($device_perm = mysql_fetch_assoc($device_perm_data)) { echo("" . $device_perm['hostname'] . "
"); $access_list[] = $device_perm['device_id']; $permdone = "yes"; } if (!$permdone) { echo("None Configured"); } // Display devices this user doesn't have access to echo("

Grant access to new device

"); echo("
"); echo("
"); echo("

Interface Access

"); $interface_perm_data = mysql_query("SELECT * from ports_perms as P, ports as I, devices as D WHERE `user_id` = '" . $_GET['user_id'] . "' AND I.interface_id = P.interface_id AND D.device_id = I.device_id"); while ($interface_perm = mysql_fetch_assoc($interface_perm_data)) { echo("
".$interface_perm['hostname']." - ".$interface_perm['ifDescr']."
". "" . $interface_perm['ifAlias'] . "
  
"); $ipermdone = "yes"; } if (!$ipermdone) { echo("None Configured"); } // Display devices this user doesn't have access to echo("

Grant access to new interface

"); echo("
Device:
Interface:
"); 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'] . "' AND P.bill_id = B.bill_id"); while ($bill_perm = mysql_fetch_assoc($bill_perm_data)) { echo("
".$bill_perm['bill_name']."  
"); $bill_access_list[] = $bill_perm['bill_id']; $bpermdone = "yes"; } if (!$bpermdone) { echo("None Configured"); } // Display devices this user doesn't have access to echo("

Grant access to new bill

"); echo("
"); echo("
"); } else { $user_list = mysql_query("SELECT * FROM `users`"); echo("

Select a user to edit

"); echo("
"); } } echo(""); ?>