Updated to support a demo user

This commit is contained in:
Neil Lathwood
2015-02-16 23:45:28 +00:00
parent f0b0ed4468
commit 2cb5d727b4
20 changed files with 57 additions and 35 deletions

View File

@@ -712,7 +712,7 @@ function generate_pagination($count,$limit,$page,$links = 2) {
} }
function is_admin() { function is_admin() {
if ($_SESSION['userlevel'] == '10') { if ($_SESSION['userlevel'] >= '10') {
$allowed = true; $allowed = true;
} else { } else {
$allowed = false; $allowed = false;
@@ -720,4 +720,8 @@ function is_admin() {
return $allowed; return $allowed;
} }
function demo_account() {
print_error("You are logged in as a demo account, this page isn't accessible to you");
}
?> ?>

View File

@@ -46,7 +46,7 @@ echo '<div class="table-responsive">
</tr>'; </tr>';
echo ('<td colspan="7">'); echo ('<td colspan="7">');
if ($_SESSION['userlevel'] == '10') { if ($_SESSION['userlevel'] >= '10') {
echo('<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#create-alert" data-device_id="'. $device['device_id'] .'">Create new alert rule</button>'); echo('<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#create-alert" data-device_id="'. $device['device_id'] .'">Create new alert rule</button>');
} }
echo ('</td> echo ('</td>
@@ -128,12 +128,12 @@ foreach( dbFetchRows($full_query, $param) as $rule ) {
} }
echo "<td><small>Max: ".$rule_extra['count']."<br />Delay: ".$rule_extra['delay']."</small></td>"; echo "<td><small>Max: ".$rule_extra['count']."<br />Delay: ".$rule_extra['delay']."</small></td>";
echo "<td>"; echo "<td>";
if ($_SESSION['userlevel'] == '10') { if ($_SESSION['userlevel'] >= '10') {
echo "<input id='".$rule['id']."' type='checkbox' name='alert-rule' data-orig_class='".$orig_class."' data-orig_colour='".$orig_col."' data-orig_state='".$orig_ico."' data-alert_id='".$rule['id']."' ".$alert_checked." data-size='small'>"; echo "<input id='".$rule['id']."' type='checkbox' name='alert-rule' data-orig_class='".$orig_class."' data-orig_colour='".$orig_col."' data-orig_state='".$orig_ico."' data-alert_id='".$rule['id']."' ".$alert_checked." data-size='small'>";
} }
echo "</td>"; echo "</td>";
echo "<td>"; echo "<td>";
if ($_SESSION['userlevel'] == '10') { if ($_SESSION['userlevel'] >= '10') {
echo "<button type='button' class='btn btn-primary btn-sm' data-toggle='modal' data-target='#create-alert' data-device_id='".$rule['device_id']."' data-alert_id='".$rule['id']."' name='edit-alert-rule'><span class='glyphicon glyphicon-pencil' aria-hidden='true'></span></button> "; echo "<button type='button' class='btn btn-primary btn-sm' data-toggle='modal' data-target='#create-alert' data-device_id='".$rule['device_id']."' data-alert_id='".$rule['id']."' name='edit-alert-rule'><span class='glyphicon glyphicon-pencil' aria-hidden='true'></span></button> ";
echo "<button type='button' class='btn btn-danger btn-sm' aria-label='Delete' data-toggle='modal' data-target='#confirm-delete' data-alert_id='".$rule['id']."' name='delete-alert-rule'><span class='glyphicon glyphicon-trash' aria-hidden='true'></span></button>"; echo "<button type='button' class='btn btn-danger btn-sm' aria-label='Delete' data-toggle='modal' data-target='#confirm-delete' data-alert_id='".$rule['id']."' name='delete-alert-rule'><span class='glyphicon glyphicon-trash' aria-hidden='true'></span></button>";
} }
@@ -153,7 +153,7 @@ echo '</table>
</div>'; </div>';
if($count < 1) { if($count < 1) {
if ($_SESSION['userlevel'] == '10') { if ($_SESSION['userlevel'] >= '10') {
echo '<div class="row"> echo '<div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<form role="form" method="post"> <form role="form" method="post">

View File

@@ -27,7 +27,7 @@ echo '<div class="table-responsive">
<tr> <tr>
<td>'; <td>';
if ($_SESSION['userlevel'] == '10') { if ($_SESSION['userlevel'] >= '10') {
echo('<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#alert-template">Create new alert template</button>'); echo('<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#alert-template">Create new alert template</button>');
} }
@@ -62,7 +62,7 @@ foreach( dbFetchRows($full_query, $param) as $template ) {
echo '<tr id="row_'.$template['id'].'"> echo '<tr id="row_'.$template['id'].'">
<td>'.$template['name'].'</td> <td>'.$template['name'].'</td>
<td>'; <td>';
if ($_SESSION['userlevel'] == '10') { if ($_SESSION['userlevel'] >= '10') {
echo "<button type='button' class='btn btn-primary btn-sm' data-toggle='modal' data-target='#alert-template' data-template_id='".$template['id']."' data-template_action='edit' name='edit-alert-template'><span class='glyphicon glyphicon-pencil' aria-hidden='true'></span></button> "; echo "<button type='button' class='btn btn-primary btn-sm' data-toggle='modal' data-target='#alert-template' data-template_id='".$template['id']."' data-template_action='edit' name='edit-alert-template'><span class='glyphicon glyphicon-pencil' aria-hidden='true'></span></button> ";
echo "<button type='button' class='btn btn-danger btn-sm' data-toggle='modal' data-target='#confirm-delete-alert-template' data-template_id='".$template['id']."' name='delete-alert-template'><span class='glyphicon glyphicon-trash' aria-hidden='true'></span></button> "; echo "<button type='button' class='btn btn-danger btn-sm' data-toggle='modal' data-target='#confirm-delete-alert-template' data-template_id='".$template['id']."' name='delete-alert-template'><span class='glyphicon glyphicon-trash' aria-hidden='true'></span></button> ";
echo "<button type='button' class='btn btn-warning btn-sm' data-toggle='modal' data-target='#attach-alert-template' data-template_id='".$template['id']."' name='attach-alert-template'><span class='glyphicon glyphicon-th-list' aria-hidden='true'></span></button>"; echo "<button type='button' class='btn btn-warning btn-sm' data-toggle='modal' data-target='#attach-alert-template' data-template_id='".$template['id']."' name='attach-alert-template'><span class='glyphicon glyphicon-th-list' aria-hidden='true'></span></button>";

View File

@@ -27,7 +27,7 @@ echo '<div class="table-responsive">
</tr>'; </tr>';
echo ('<td colspan="5">'); echo ('<td colspan="5">');
if ($_SESSION['userlevel'] == '10') { if ($_SESSION['userlevel'] >= '10') {
echo('<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#create-alert" data-device_id="'. $device['device_id'] .'">Create new alert rule</button>'); echo('<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#create-alert" data-device_id="'. $device['device_id'] .'">Create new alert rule</button>');
} }
echo ('</td> echo ('</td>
@@ -96,7 +96,7 @@ foreach( dbFetchRows($full_query, $param) as $alert ) {
} }
echo "</td>"; echo "</td>";
echo "<td>"; echo "<td>";
if ($_SESSION['userlevel'] == '10') { if ($_SESSION['userlevel'] >= '10') {
$ack_ico = 'volume-up'; $ack_ico = 'volume-up';
$ack_col = 'success'; $ack_col = 'success';
if(in_array($alert['state'],array(2,3,4))) { if(in_array($alert['state'],array(2,3,4))) {

View File

@@ -43,7 +43,7 @@ if (isset($config['enable_bgp']) && $config['enable_bgp'])
<li><a href="<?php echo(generate_url(array('page'=>'overview'))); ?>"><img src="images/16/lightbulb.png" border="0" align="absmiddle" /> Overview</a></li> <li><a href="<?php echo(generate_url(array('page'=>'overview'))); ?>"><img src="images/16/lightbulb.png" border="0" align="absmiddle" /> Overview</a></li>
<li><a href="<?php echo(generate_url(array('page'=>'alerts'))); ?>"><img src="images/16/monitor_error.png" border="0" align="absmiddle" /> Alerts</a></li> <li><a href="<?php echo(generate_url(array('page'=>'alerts'))); ?>"><img src="images/16/monitor_error.png" border="0" align="absmiddle" /> Alerts</a></li>
<?php <?php
if ($_SESSION['userlevel'] == '10') { if ($_SESSION['userlevel'] >= '10') {
?> ?>
<li><a href="<?php echo(generate_url(array('page'=>'alert-rules'))); ?>"><img src="images/16/monitor_go.png" border="0" align="absmiddle" /> Alert Rules</a></li> <li><a href="<?php echo(generate_url(array('page'=>'alert-rules'))); ?>"><img src="images/16/monitor_go.png" border="0" align="absmiddle" /> Alert Rules</a></li>
<li><a href="<?php echo(generate_url(array('page'=>'templates'))); ?>"><img src="images/16/monitor_link.png" border="0" align="absmiddle" /> Alert Templates</a></li> <li><a href="<?php echo(generate_url(array('page'=>'templates'))); ?>"><img src="images/16/monitor_link.png" border="0" align="absmiddle" /> Alert Templates</a></li>

View File

@@ -8,7 +8,7 @@ else
{ {
if ($_POST['addsrv']) if ($_POST['addsrv'])
{ {
if ($_SESSION['userlevel'] == '10') if ($_SESSION['userlevel'] >= '10')
{ {
$updated = '1'; $updated = '1';

View File

@@ -4,6 +4,9 @@ if ($_SESSION['userlevel'] < '10')
{ {
include("includes/error-no-perm.inc.php"); include("includes/error-no-perm.inc.php");
} }
elseif ($_SESSION['userlevel'] == 11) {
demo_account();
}
else else
{ {
echo("<h3>Add User</h3>"); echo("<h3>Add User</h3>");
@@ -92,6 +95,7 @@ echo("
<option value='1'>Normal User</option> <option value='1'>Normal User</option>
<option value='5'>Global Read</option> <option value='5'>Global Read</option>
<option value='10'>Administrator</option> <option value='10'>Administrator</option>
<option value='11'>Demo account</option>
</select> </select>
</div> </div>
<div class='col-sm-6'> <div class='col-sm-6'>

View File

@@ -12,7 +12,7 @@
* the source code distribution for details. * the source code distribution for details.
*/ */
if ($_SESSION['userlevel'] == '10') if ($_SESSION['userlevel'] >= '10')
{ {
if(empty($_POST['token'])) { if(empty($_POST['token'])) {
$_POST['token'] = bin2hex(openssl_random_pseudo_bytes(16)); $_POST['token'] = bin2hex(openssl_random_pseudo_bytes(16));

View File

@@ -1,6 +1,6 @@
<?php <?php
if ($_SESSION['userlevel'] == '10') if ($_SESSION['userlevel'] >= '10')
{ {
echo("<table cellspacing=0 cellpadding=1 width=100%>"); echo("<table cellspacing=0 cellpadding=1 width=100%>");

View File

@@ -2,7 +2,7 @@
$bill_id = mres($vars['bill_id']); $bill_id = mres($vars['bill_id']);
if ($_SESSION['userlevel'] == "10") if ($_SESSION['userlevel'] >= "10")
{ {
include("pages/bill/actions.inc.php"); include("pages/bill/actions.inc.php");
} }
@@ -94,7 +94,7 @@ if (bill_permitted($bill_id))
echo('<A href="'.generate_url($vars, array('view' => 'history')).'">Historical Usage</a>'); echo('<A href="'.generate_url($vars, array('view' => 'history')).'">Historical Usage</a>');
if ($vars['view'] == "history") { echo("</span>"); } if ($vars['view'] == "history") { echo("</span>"); }
if ($_SESSION['userlevel'] == "10") if ($_SESSION['userlevel'] >= "10")
{ {
echo(" | "); echo(" | ");
if ($vars['view'] == "edit") { echo("<span class='pagemenu-selected'>"); } if ($vars['view'] == "edit") { echo("<span class='pagemenu-selected'>"); }
@@ -116,15 +116,15 @@ if (bill_permitted($bill_id))
print_optionbar_end(); print_optionbar_end();
if ($vars['view'] == "edit" && $_SESSION['userlevel'] == "10") if ($vars['view'] == "edit" && $_SESSION['userlevel'] >= "10")
{ {
include("pages/bill/edit.inc.php"); include("pages/bill/edit.inc.php");
} }
elseif ($vars['view'] == "delete" && $_SESSION['userlevel'] == "10") elseif ($vars['view'] == "delete" && $_SESSION['userlevel'] >= "10")
{ {
include("pages/bill/delete.inc.php"); include("pages/bill/delete.inc.php");
} }
elseif ($vars['view'] == "reset" && $_SESSION['userlevel'] == "10") elseif ($vars['view'] == "reset" && $_SESSION['userlevel'] >= "10")
{ {
include("pages/bill/reset.inc.php"); include("pages/bill/reset.inc.php");
} }

View File

@@ -64,7 +64,7 @@ elseif ($vars['view'] == "add")
print_optionbar_start(); print_optionbar_start();
echo("<span style='font-weight: bold;'>Bill</span> &#187; "); echo("<span style='font-weight: bold;'>Bill</span> &#187; ");
if (!$vars['view']) { $vars['view'] = "add"; } if (!$vars['view']) { $vars['view'] = "add"; }
if ($_SESSION['userlevel'] == "10") if ($_SESSION['userlevel'] >= "10")
{ {
if ($vars['view'] == "add") { echo("<span class='pagemenu-selected'>"); } if ($vars['view'] == "add") { echo("<span class='pagemenu-selected'>"); }
echo('<A href="'.generate_url(array('page' => "bills/add")).'">Add</a>'); echo('<A href="'.generate_url(array('page' => "bills/add")).'">Add</a>');

View File

@@ -11,6 +11,10 @@ if ($_SESSION['userlevel'] < 10)
$pagetitle[] = "Delete device"; $pagetitle[] = "Delete device";
if ($_SESSION['userlevel'] == 11) {
demo_account();
} else {
if (is_numeric($_REQUEST['id'])) if (is_numeric($_REQUEST['id']))
{ {
echo(' echo('
@@ -82,4 +86,5 @@ foreach (dbFetchRows("SELECT * FROM `devices` ORDER BY `hostname`") as $data)
</form> </form>
<?php <?php
} }
}
?> ?>

View File

@@ -3,13 +3,13 @@
echo('<div style="padding: 10px;">'); echo('<div style="padding: 10px;">');
if ($_POST['addsrv']) { if ($_POST['addsrv']) {
if ($_SESSION['userlevel'] == '10') { if ($_SESSION['userlevel'] >= '10') {
include("includes/service-add.inc.php"); include("includes/service-add.inc.php");
} }
} }
if ($_POST['delsrv']) { if ($_POST['delsrv']) {
if ($_SESSION['userlevel'] == '10') { if ($_SESSION['userlevel'] >= '10') {
include("includes/service-delete.inc.php"); include("includes/service-delete.inc.php");
} }
} }

View File

@@ -148,7 +148,7 @@ if (dbFetchCell("SELECT COUNT(*) FROM juniAtmVp WHERE port_id = '".$port['port_i
if ($vars['view'] == "junose-atm-vp" && $vars['graph'] == "bits") { echo("</span>"); } if ($vars['view'] == "junose-atm-vp" && $vars['graph'] == "bits") { echo("</span>"); }
} }
if ($_SESSION['userlevel'] == '10') if ($_SESSION['userlevel'] >= '10')
{ {
echo("<span style='float: right;'><a href='bills/view=add/port=".$port['port_id']."/'><img src='images/16/money.png' border='0' align='absmiddle'> Create Bill</a></span>"); echo("<span style='float: right;'><a href='bills/view=add/port=".$port['port_id']."/'><img src='images/16/money.png' border='0' align='absmiddle'> Create Bill</a></span>");
} }

View File

@@ -316,6 +316,7 @@ if ($_SESSION['userlevel'] != '10') { include("includes/error-no-perm.inc.php");
<option value='1'"); if( $vars['new_level'] == '1') { echo("selected"); } echo(">Normal User</option> <option value='1'"); if( $vars['new_level'] == '1') { echo("selected"); } echo(">Normal User</option>
<option value='5'"); if( $vars['new_level'] == '5') { echo("selected"); } echo(">Global Read</option> <option value='5'"); if( $vars['new_level'] == '5') { echo("selected"); } echo(">Global Read</option>
<option value='10'"); if( $vars['new_level'] == '10') { echo("selected"); } echo(">Administrator</option> <option value='10'"); if( $vars['new_level'] == '10') { echo("selected"); } echo(">Administrator</option>
<option value='11'"); if( $vars['new_level'] == '11') { echo("selected"); } echo(">Demo account</option>
</select> </select>
</div> </div>
<div class='col-sm-6'> <div class='col-sm-6'>

View File

@@ -31,7 +31,7 @@ echo('<div class="status-boxes">');
$count_boxes = 0; $count_boxes = 0;
// Device down boxes // Device down boxes
if ($_SESSION['userlevel'] == '10') if ($_SESSION['userlevel'] >= '10')
{ {
$sql = "SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0' LIMIT ".$config['front_page_down_box_limit']; $sql = "SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0' LIMIT ".$config['front_page_down_box_limit'];
} else { } else {
@@ -45,7 +45,7 @@ foreach (dbFetchRows($sql) as $device)
++$count_boxes; ++$count_boxes;
} }
if ($_SESSION['userlevel'] == '10') if ($_SESSION['userlevel'] >= '10')
{ {
$sql = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0' LIMIT ".$config['front_page_down_box_limit']; $sql = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0' LIMIT ".$config['front_page_down_box_limit'];
} else { } else {
@@ -74,7 +74,7 @@ if ($config['warn']['ifdown'])
/* FIXME service permissions? seem nonexisting now.. */ /* FIXME service permissions? seem nonexisting now.. */
// Service down boxes // Service down boxes
if ($_SESSION['userlevel'] == '10') if ($_SESSION['userlevel'] >= '10')
{ {
$sql = "SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0' LIMIT ".$config['front_page_down_box_limit']; $sql = "SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0' LIMIT ".$config['front_page_down_box_limit'];
$param[] = ''; $param[] = '';
@@ -96,7 +96,7 @@ foreach (dbFetchRows($sql,$param) as $service)
// BGP neighbour down boxes // BGP neighbour down boxes
if (isset($config['enable_bgp']) && $config['enable_bgp']) if (isset($config['enable_bgp']) && $config['enable_bgp'])
{ {
if ($_SESSION['userlevel'] == '10') if ($_SESSION['userlevel'] >= '10')
{ {
$sql = "SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus != 'start' AND bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0 LIMIT ".$config['front_page_down_box_limit']; $sql = "SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus != 'start' AND bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0 LIMIT ".$config['front_page_down_box_limit'];
} else { } else {
@@ -115,7 +115,7 @@ if (isset($config['enable_bgp']) && $config['enable_bgp'])
// Device rebooted boxes // Device rebooted boxes
if (filter_var($config['uptime_warning'], FILTER_VALIDATE_FLOAT) !== FALSE && $config['uptime_warning'] > 0) if (filter_var($config['uptime_warning'], FILTER_VALIDATE_FLOAT) !== FALSE && $config['uptime_warning'] > 0)
{ {
if ($_SESSION['userlevel'] == '10') if ($_SESSION['userlevel'] >= '10')
{ {
$sql = "SELECT * FROM `devices` AS D WHERE D.status = '1' AND D.uptime > 0 AND D.uptime < '" . $config['uptime_warning'] . "' AND D.ignore = 0 LIMIT ".$config['front_page_down_box_limit']; $sql = "SELECT * FROM `devices` AS D WHERE D.status = '1' AND D.uptime > 0 AND D.uptime < '" . $config['uptime_warning'] . "' AND D.ignore = 0 LIMIT ".$config['front_page_down_box_limit'];
} else { } else {
@@ -196,7 +196,7 @@ if ($config['enable_syslog'])
} else { } else {
if ($_SESSION['userlevel'] == '10') if ($_SESSION['userlevel'] >= '10')
{ {
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,15"; $query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,15";
} else { } else {

View File

@@ -76,7 +76,7 @@ echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; fl
echo("<div style='padding: 3px 10px; background: #fff;'>"); echo("<div style='padding: 3px 10px; background: #fff;'>");
if ($_SESSION['userlevel'] == '10') if ($_SESSION['userlevel'] >= '10')
{ {
$sql = "SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'"; $sql = "SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'";
} else { } else {
@@ -91,7 +91,7 @@ foreach (dbFetchRows($sql) as $device)
} }
if ($_SESSION['userlevel'] == '10') if ($_SESSION['userlevel'] >= '10')
{ {
$sql = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'"; $sql = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'";
} else { } else {
@@ -130,7 +130,7 @@ foreach (dbFetchRows($sql) as $service)
if (isset($config['enable_bgp']) && $config['enable_bgp']) if (isset($config['enable_bgp']) && $config['enable_bgp'])
{ {
if ($_SESSION['userlevel'] == '10') if ($_SESSION['userlevel'] >= '10')
{ {
$sql = "SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus != 'start' AND bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0"; $sql = "SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus != 'start' AND bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0";
} else { } else {
@@ -148,7 +148,7 @@ if (isset($config['enable_bgp']) && $config['enable_bgp'])
if (filter_var($config['uptime_warning'], FILTER_VALIDATE_FLOAT) !== FALSE && $config['uptime_warning'] > 0) if (filter_var($config['uptime_warning'], FILTER_VALIDATE_FLOAT) !== FALSE && $config['uptime_warning'] > 0)
{ {
if ($_SESSION['userlevel'] == '10') if ($_SESSION['userlevel'] >= '10')
{ {
$sql = "SELECT * FROM `devices` AS D WHERE D.status = '1' AND D.uptime > 0 AND D.uptime < '" . $config['uptime_warning'] . "' AND D.ignore = 0"; $sql = "SELECT * FROM `devices` AS D WHERE D.status = '1' AND D.uptime > 0 AND D.uptime < '" . $config['uptime_warning'] . "' AND D.ignore = 0";
} else { } else {
@@ -191,7 +191,7 @@ if ($config['enable_syslog'])
<h3>Recent Eventlog Entries</h3> <h3>Recent Eventlog Entries</h3>
"); ");
if ($_SESSION['userlevel'] == '10') if ($_SESSION['userlevel'] >= '10')
{ {
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,15"; $query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,15";
} else { } else {

View File

@@ -35,7 +35,7 @@ echo('<table cellpadding="7" cellspacing="0" class="devicetable" width="100%">')
foreach (getlocations() as $location) foreach (getlocations() as $location)
{ {
if ($_SESSION['userlevel'] == '10') if ($_SESSION['userlevel'] >= '10')
{ {
$num = dbFetchCell("SELECT COUNT(device_id) FROM devices WHERE location = ?", array($location)); $num = dbFetchCell("SELECT COUNT(device_id) FROM devices WHERE location = ?", array($location));
$net = dbFetchCell("SELECT COUNT(device_id) FROM devices WHERE location = ? AND type = 'network'", array($location)); $net = dbFetchCell("SELECT COUNT(device_id) FROM devices WHERE location = ? AND type = 'network'", array($location));

View File

@@ -4,6 +4,12 @@ $pagetitle[] = "Preferences";
echo("<h3>User Preferences</h3>"); echo("<h3>User Preferences</h3>");
if ($_SESSION['userlevel'] == 11) {
demo_account();
} else {
if ($_POST['action'] == "changepass") if ($_POST['action'] == "changepass")
{ {
if (authenticate($_SESSION['username'],$_POST['old_pass'])) if (authenticate($_SESSION['username'],$_POST['old_pass']))
@@ -167,6 +173,8 @@ if( $config['twofactor'] === true ) {
} }
} }
}
echo("<div style='background-color: #e5e5e5; border: solid #e5e5e5 10px; margin-bottom:10px;'>"); echo("<div style='background-color: #e5e5e5; border: solid #e5e5e5 10px; margin-bottom:10px;'>");
echo("<div style='font-size: 18px; font-weight: bold; margin-bottom: 5px;'>Device Permissions</div>"); echo("<div style='font-size: 18px; font-weight: bold; margin-bottom: 5px;'>Device Permissions</div>");

View File

@@ -38,7 +38,7 @@ function a2t($a) {
return $r; return $r;
} }
if( $_SESSION['userlevel'] == 10 ) { if( $_SESSION['userlevel'] >= 10 ) {
echo "<div class='table-responsive'>".a2t($config)."</div>"; echo "<div class='table-responsive'>".a2t($config)."</div>";
} else { } else {
include("includes/error-no-perm.inc.php"); include("includes/error-no-perm.inc.php");