remove the last usage of config variables outside of the $config array ($rrd_file) + fixed adduser script

git-svn-id: http://www.observium.org/svn/observer/trunk@354 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2009-03-16 15:19:44 +00:00
parent 98ba6a4f83
commit 83eb114da1
18 changed files with 74 additions and 91 deletions
+1 -1
View File
@@ -208,7 +208,7 @@ echo("</td>");
echo("</td></tr>");
// If we're showing graphs, generate the graph and print the img tags
if($dographs && is_file($rrd_dir . "/" . $hostname . "/". $ifIndex . ".rrd")) {
if($dographs && is_file($config['rrd_dir'] . "/" . $hostname . "/". $ifIndex . ".rrd")) {
$type = $_GET['type'];
+20 -11
View File
@@ -7,22 +7,31 @@ if($_SESSION['userlevel'] != '10') { echo("<span class=alert>You do not have the
echo("<h3>Add User</h3>");
if($_POST['action'] == "add") {
mysql_query("INSERT INTO `users` (`username`, `realname`, `password`, `level`) VALUES ('" . mres($_POST['new_username']) . "', '" . mres($_POST['new_realname']) . "', MD5('" . mres($_POST['new_password']) . "'), '" . mres($_POST['new_level']) . "')");
if(mysql_affected_rows()) { echo("<span class=info>User " . $_GET['username'] . " added!</span>"); }
if($_POST['new_username'] && $_POST['new_password'] && !mysql_result(mysql_query("SELECT * FROM users WHERE username = '".$_POST['new_username']."'"),0) ) {
mysql_query("INSERT INTO `users` (`username`, `realname`, `password`, `level`) VALUES ('" . mres($_POST['new_username']) . "', '" . mres($_POST['new_realname']) . "', MD5('" . mres($_POST['new_password']) . "'), '" . mres($_POST['new_level']) . "')");
if(mysql_affected_rows()) { echo("<span class=info>User " . $_POST['username'] . " added!</span>"); }
}
}
echo("<form method='post' action='?page=adduser'>
<input type='hidden' value='add' name='action'>");
echo("Username <input name='new_username'></input><br />");
echo("Password <input name='new_password'></input><br />");
echo("Realname <input name='new_realname'></input><br /><br />");
echo("<select name='new_level'>
echo("Username <input style='margin: 1px;' name='new_username'></input><br />");
if($_POST['action'] == "add" && !$_POST['new_username']) {
echo("<div class=red>Please enter a username!</div>");
} elseif( mysql_result(mysql_query("SELECT * FROM users WHERE username = '".$_POST['new_username']."'"),0)) {
echo("<span class=red>User with this name already exists!</span><br />");
}
?>
Password <input style='margin: 1px;' name='new_password' id='new_password' type=password /><br />
<?php
if($_POST['action'] == "add" && !$_POST['new_password']) {
echo("<span class=red>Please enter a password!</span><br />");
}
echo("Realname <input style='margin: 1px;' name='new_realname'></input><br />");
?>
<?php
echo("Level <select style='margin: 5px;' name='new_level'>
<option value='1'>Normal User</option>
<option value='5'>Global Read</option>
<option value='10'>Administrator</option>
+12 -1
View File
@@ -1,10 +1,21 @@
<?php
include("includes/geshi/geshi.php");
if($_SESSION[userlevel] >= "5" && is_file($config['rancid_configs'] . $device['hostname'])) {
$file = $config['rancid_configs'] . $device['hostname'];
# $file = "/testconfig.txt";
$fh = fopen($file, 'r') or die("Can't open file");
$text = fread($fh, filesize($file));
echo(highlight_string($text));
$language = "ios";
$geshi = new GeSHi($text, $language);
$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS);
$geshi->set_overall_style('color: black;');
# $geshi->set_line_style('color: #999999');
# echo("<div style='width:1175px;height:540px;overflow-x:hidden;overflow-y:auto;'>");
echo $geshi->parse_code();
# echo("</div>");
fclose($fh);
} else {
print_error("Error : Insufficient access.");
+1 -1
View File
@@ -24,7 +24,7 @@ if($_GET['type']) {
echo("</td></tr><tr bgcolor='$bg'><td>");
if(file_exists($rrd_dir . "/" . $interface['hostname'] . "/" . $interface['ifIndex'] . ".rrd")) {
if(file_exists($config['rrd_dir'] . "/" . $interface['hostname'] . "/" . $interface['ifIndex'] . ".rrd")) {
$graph_type = "bits";
include("includes/print-interface-graphs.php");