improved authentication checks (not sure this file is the right place, but meh) from sovern (also some fixes for diskio_ops)

git-svn-id: http://www.observium.org/svn/observer/trunk@1299 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2010-07-05 19:19:19 +00:00
parent 9851b77203
commit 96c74a23bb
3 changed files with 20 additions and 5 deletions

View File

@@ -3,6 +3,22 @@
@ini_set("session.gc_maxlifetime","0");
session_start();
// Preflight checks
if(!is_dir($config['rrd_dir']))
echo "<div class='errorbox'>RRD Log Directory is missing ({$config['rrd_dir']}). Graphing may fail.</div>";
if(!is_writable($config['rrd_dir']))
echo "<div class='errorbox'>RRD Log Directory is not writable ({$config['rrd_dir']}). Graphing may fail.</div>";
if(!is_dir($config['tmp_dir']))
echo "<div class='errorbox'>Temp Directory is missing ({$config['tmp_dir']}). Graphing may fail.</div>";
if(!is_writable($config['tmp_dir']))
echo "<div class='errorbox'>Temp Directory is not writable ({$config['tmp_dir']}). Graphing may fail.</div>";
if(isset($_GET['logout']) && $_SESSION['authenticated']) {
mysql_query("INSERT INTO authlog (`user`,`address`,`result`) VALUES ('" . $_SESSION['username'] . "', '".$_SERVER["REMOTE_ADDR"]."', 'logged out')");
unset($_SESSION);
@@ -34,8 +50,7 @@ if (file_exists('includes/authentication/' . $config['auth_mechanism'] . '.inc.p
}
else
{
# FIXME use standard error message box?
echo "ERROR: no valid auth_mechanism defined.";
echo "<div class='errorbox'>ERROR: no valid auth_mechanism defined</div>";
exit();
}

View File

@@ -212,10 +212,10 @@ function generate_port_thumbnail($args)
echo $output;
}
function print_optionbar_start ($height = 20, $width = 0)
function print_optionbar_start ($height = 20, $width = 0, $marginbottom = 5)
{
echo("
<div style='text-align: center; margin-top: 0px; margin-bottom: 0px; " . ($width ? 'max-width: ' . $width . (strstr($width,'%') ? '' : 'px') . '; ' : '') . "'>
<div style='text-align: center; margin-top: 0px; margin-bottom: ".$marginbottom."px; " . ($width ? 'max-width: ' . $width . (strstr($width,'%') ? '' : 'px') . '; ' : '') . "'>
<b class='rounded'>
<b class='rounded1'><b></b></b>
<b class='rounded2'><b></b></b>

View File

@@ -22,7 +22,7 @@ $colour_area_out_max = "FF9966";
$graph_max = 1;
$unit_text = "Operations";
$unit_text = "Ops/s";
include("generic_duplex.inc.php");