2006-07-11 16:14:09 +02:00
|
|
|
<?php
|
|
|
|
|
2007-06-22 14:00:04 +02:00
|
|
|
// Pandora FMS - the Free Monitoring System
|
2007-02-20 02:38:59 +01:00
|
|
|
// ========================================
|
2007-03-12 18:58:52 +01:00
|
|
|
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
|
2007-06-12 20:10:57 +02:00
|
|
|
// Main PHP/SQL code development, project architecture and management.
|
2007-02-20 02:38:59 +01:00
|
|
|
// Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
|
2007-05-03 Sancho Lerena <slerena@artica.es>
* include/FreeSans.ttf: Added to repos, should be here to use in graphs.
* include/functions_db.php: Deleted noaccess include from
comprueba_login(). This should return value, not render pages or
exit.
* include/config.inc.php: Modified some typos.
* include/calendar.js: Added generic calendar javascript, to be
used on exportdata and incident management code.
* include/languages/language_en.php: More strings.
* install.php: In my render, box height is too low. PLEASE recheck
before changing this kind of properties because in other browsers
could have a bad render (Sophus!).
* index.php: Added script call (need to be done on header).
* operation/agentes/export_csv.php: Added new file to create a
standalone CSV on download icon / link.
* operation/agentes/exportdata.php: New export data code, used
some code from Leando Doctors, and mixed with old code. Now have
three options to render export data.
* operation/agentes/datos_agente_calendar.php: Deleted old code from Leandro.
* operation/active_console/lib/extra_functions.php: Solved a lot
of warnings, but there are TONS of more warnings that need to be
corrected.
* operation/active_console/lib/db_functions.php:Solved a lot of
warnings, but there are TONS of more warnings that need to be
corrected.
* operation/active_console/index.php: Solved a lot of warnings,
but there are TONS of more warnings that need to be
corrected. This code DONT work if you are showing warning/notice
erros. This code is not ready for production usage, too buggy yet
:(
* pandora_graphical_console_data.sql: Cleanup.
* godmode/agentes/module_manager.php: Added wizard button.
* pandora_graphical_console.sql: Cleanup.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@448 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-05-03 04:08:00 +02:00
|
|
|
// CSS and some PHP code additions
|
2007-05-30 19:32:35 +02:00
|
|
|
// Copyright (c) 2006 Jose Navarro <jnavarro@jnavarro.net>
|
2007-06-12 20:10:57 +02:00
|
|
|
// Additions to code for Pandora FMS 1.2 graph code
|
2007-06-22 14:00:04 +02:00
|
|
|
|
2006-06-29 21:31:53 +02:00
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
2007-06-12 20:10:57 +02:00
|
|
|
// as published by the Free Software Foundation for version 2.
|
2006-06-29 21:31:53 +02:00
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2006-03-27 05:37:27 +02:00
|
|
|
|
2007-02-05 18:45:14 +01:00
|
|
|
// Pandora FMS 1.x uses icons from famfamfam, licensed under CC Atr. 2.5
|
2007-02-20 02:38:59 +01:00
|
|
|
// Silk icon set 1.3 (cc) Mark James, http://www.famfamfam.com/lab/icons/silk/
|
2007-02-20 19:09:54 +01:00
|
|
|
// Pandora FMS 1.x uses Pear Image::Graph code
|
2007-02-20 02:38:59 +01:00
|
|
|
|
2007-08-06 11:19:22 +02:00
|
|
|
//Pandora Version, if not defined here it would take from config.php
|
|
|
|
$build_version="PC070806";
|
2007-07-18 20:01:06 +02:00
|
|
|
$pandora_version="v1.3-dev";
|
2007-05-30 19:32:35 +02:00
|
|
|
global $build_version;
|
|
|
|
global $pandora_version;
|
|
|
|
|
2007-06-12 20:10:57 +02:00
|
|
|
// Set to 1 to do not check for installer or config file (for development!).
|
2007-08-06 11:19:22 +02:00
|
|
|
$develop_bypass = 0;
|
2007-04-11 05:12:48 +02:00
|
|
|
|
2007-02-20 19:09:54 +01:00
|
|
|
if ($develop_bypass != 1){
|
|
|
|
// If no config file, automatically try to install
|
|
|
|
if (! file_exists("include/config.php")){
|
2007-04-11 05:12:48 +02:00
|
|
|
if (!file_exists("install.php")){
|
|
|
|
include "general/error_install.php";
|
|
|
|
exit;
|
|
|
|
} else
|
|
|
|
include ("install.php");
|
2007-02-20 19:09:54 +01:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
// Check for installer presence
|
|
|
|
if (file_exists("install.php")){
|
|
|
|
include "general/error_install.php";
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
// Check perms for config.php
|
|
|
|
if ((substr(sprintf('%o', fileperms('include/config.php')), -4) != "0600") &&
|
2007-03-19 20:39:40 +01:00
|
|
|
(substr(sprintf('%o', fileperms('include/config.php')), -4) != "0660") &&
|
|
|
|
(substr(sprintf('%o', fileperms('include/config.php')), -4) != "0640") &&
|
|
|
|
(substr(sprintf('%o', fileperms('include/config.php')), -4) != "0600"))
|
2007-02-20 19:09:54 +01:00
|
|
|
{
|
|
|
|
include "general/error_perms.php";
|
|
|
|
exit;
|
|
|
|
}
|
2007-02-20 02:38:59 +01:00
|
|
|
}
|
2007-02-05 18:45:14 +01:00
|
|
|
|
2007-02-20 19:09:54 +01:00
|
|
|
// Real start
|
2007-05-30 19:32:35 +02:00
|
|
|
session_start();
|
2006-03-27 05:37:27 +02:00
|
|
|
include "include/config.php";
|
|
|
|
include "include/languages/language_".$language_code.".php";
|
2007-02-20 19:09:54 +01:00
|
|
|
require "include/functions.php"; // Including funcions.
|
|
|
|
require "include/functions_db.php";
|
2006-03-27 05:37:27 +02:00
|
|
|
?>
|
2006-06-29 21:31:53 +02:00
|
|
|
|
2006-03-27 05:37:27 +02:00
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<?php
|
|
|
|
// Refresh page
|
2007-05-20 19:12:31 +02:00
|
|
|
if ( (isset ($_GET["refr"])) || (isset($_POST["refr"])) ){
|
|
|
|
if (isset ($_GET["refr"]))
|
|
|
|
$intervalo = entrada_limpia ($_GET["refr"]);
|
|
|
|
if (isset ($_POST["refr"]))
|
|
|
|
$intervalo = entrada_limpia ($_POST["refr"]);
|
|
|
|
if ($intervalo > 0){
|
|
|
|
// Agent selection filters and refresh
|
|
|
|
$query = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . '&refr=' . $intervalo;
|
|
|
|
if (isset ($_POST["ag_group"])) {
|
|
|
|
$ag_group = $_POST["ag_group"];
|
|
|
|
$query = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . '&ag_group_refresh=' . $ag_group;
|
|
|
|
} else
|
|
|
|
echo '<meta http-equiv="refresh" content="' . $intervalo . '; URL=' . $query . '">';
|
|
|
|
}
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
|
|
|
?>
|
2006-11-06 11:33:04 +01:00
|
|
|
<title>Pandora FMS - <?php echo $lang_label["header_title"]; ?></title>
|
2006-03-27 05:37:27 +02:00
|
|
|
<meta http-equiv="expires" content="0">
|
2007-06-12 20:10:57 +02:00
|
|
|
<meta http-equiv="content-type" content="text/html; charset=utf8">
|
2006-03-27 05:37:27 +02:00
|
|
|
<meta name="resource-type" content="document">
|
|
|
|
<meta name="distribution" content="global">
|
|
|
|
<meta name="author" content="Sancho Lerena, Raul Mateos">
|
|
|
|
<meta name="copyright" content="This is GPL software. Created by Sancho Lerena and others">
|
|
|
|
<meta name="keywords" content="pandora, monitoring, system, GPL, software">
|
|
|
|
<meta name="robots" content="index, follow">
|
|
|
|
<link rel="icon" href="images/pandora.ico" type="image/ico">
|
2007-05-27 04:55:55 +02:00
|
|
|
<?php
|
2007-05-24 23:06:42 +02:00
|
|
|
// Pandora FMS 1.3 custom style selection
|
|
|
|
echo '<link rel="stylesheet" href="include/styles/'.$config_style.'.css" type="text/css">';
|
|
|
|
?>
|
2007-06-27 19:45:42 +02:00
|
|
|
|
2007-05-20 19:12:31 +02:00
|
|
|
<script type="text/javascript" src="include/javascript/wz_jsgraphics.js"></script>
|
2006-03-27 05:37:27 +02:00
|
|
|
</head>
|
2007-02-16 19:29:37 +01:00
|
|
|
|
|
|
|
<?php
|
2006-07-01 03:48:56 +02:00
|
|
|
// Show custom background
|
2007-05-27 04:55:55 +02:00
|
|
|
echo '<body bgcolor="#555555">';
|
2006-12-15 16:25:19 +01:00
|
|
|
$REMOTE_ADDR = getenv ("REMOTE_ADDR");
|
2006-03-27 05:37:27 +02:00
|
|
|
global $REMOTE_ADDR;
|
2006-12-15 16:25:19 +01:00
|
|
|
|
|
|
|
// Login process
|
|
|
|
if ( (! isset ($_SESSION['id_usuario'])) AND (isset ($_GET["login"]))) {
|
|
|
|
$nick = entrada_limpia ($_POST["nick"]);
|
|
|
|
$pass = entrada_limpia ($_POST["pass"]);
|
|
|
|
|
2006-03-27 05:37:27 +02:00
|
|
|
// Connect to Database
|
2006-12-15 16:25:19 +01:00
|
|
|
$sql1 = 'SELECT * FROM tusuario WHERE id_usuario = "'.$nick.'"';
|
|
|
|
$result = mysql_query ($sql1);
|
|
|
|
|
|
|
|
// For every registry
|
|
|
|
if ($row = mysql_fetch_array ($result)){
|
|
|
|
if ($row["password"] == md5 ($pass)){
|
|
|
|
// Login OK
|
|
|
|
// Nick could be uppercase or lowercase (select in MySQL
|
|
|
|
// is not case sensitive)
|
|
|
|
// We get DB nick to put in PHP Session variable,
|
|
|
|
// to avoid problems with case-sensitive usernames.
|
2006-03-27 05:37:27 +02:00
|
|
|
// Thanks to David Muñiz for Bug discovery :)
|
|
|
|
$nick = $row["id_usuario"];
|
2006-12-15 16:25:19 +01:00
|
|
|
unset ($_GET["sec2"]);
|
|
|
|
$_GET["sec"] = "general/logon_ok";
|
|
|
|
update_user_contact ($nick);
|
|
|
|
logon_db ($nick, $REMOTE_ADDR);
|
|
|
|
$_SESSION['id_usuario'] = $nick;
|
2006-03-27 05:37:27 +02:00
|
|
|
|
2006-12-15 16:25:19 +01:00
|
|
|
} else {
|
|
|
|
// Login failed (bad password)
|
|
|
|
unset ($_GET["sec2"]);
|
2006-03-27 05:37:27 +02:00
|
|
|
include "general/logon_failed.php";
|
|
|
|
// change password to do not show all string
|
2006-12-15 16:25:19 +01:00
|
|
|
$primera = substr ($pass,0,1);
|
|
|
|
$ultima = substr ($pass, strlen ($pass) - 1, 1);
|
|
|
|
$pass = $primera . "****" . $ultima;
|
|
|
|
audit_db ($nick, $REMOTE_ADDR, "Logon Failed",
|
|
|
|
"Incorrect password: " . $nick . " / " . $pass);
|
2006-03-27 05:37:27 +02:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|
2006-12-15 16:25:19 +01:00
|
|
|
else {
|
|
|
|
// User not known
|
|
|
|
unset ($_GET["sec2"]);
|
2006-03-27 05:37:27 +02:00
|
|
|
include "general/logon_failed.php";
|
2006-12-15 16:25:19 +01:00
|
|
|
$primera = substr ($pass, 0, 1);
|
|
|
|
$ultima = substr ($pass, strlen ($pass) - 1, 1);
|
|
|
|
$pass = $primera . "****" . $ultima;
|
|
|
|
audit_db ($nick, $REMOTE_ADDR, "Logon Failed",
|
|
|
|
"Invalid username: " . $nick . " / " . $pass);
|
2006-03-27 05:37:27 +02:00
|
|
|
exit;
|
|
|
|
}
|
2006-12-15 16:25:19 +01:00
|
|
|
} elseif (! isset ($_SESSION['id_usuario'])) {
|
|
|
|
// There is no user connected
|
2006-03-27 05:37:27 +02:00
|
|
|
include "general/login_page.php";
|
|
|
|
exit;
|
|
|
|
}
|
2007-03-02 18:56:07 +01:00
|
|
|
|
|
|
|
// Log off
|
|
|
|
if (isset ($_GET["bye"])) {
|
|
|
|
include "general/logoff.php";
|
2006-12-15 16:25:19 +01:00
|
|
|
$iduser = $_SESSION["id_usuario"];
|
|
|
|
logoff_db ($iduser, $REMOTE_ADDR);
|
|
|
|
session_unregister ("id_usuario");
|
2007-03-02 18:56:07 +01:00
|
|
|
exit;
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
2007-02-27 20:03:56 +01:00
|
|
|
$pagina = "";
|
2007-03-02 18:56:07 +01:00
|
|
|
if (isset ($_GET["sec2"])){
|
|
|
|
$sec2 = parametro_limpio ($_GET["sec2"]);
|
|
|
|
$pagina = $sec2;
|
|
|
|
} else
|
|
|
|
$sec2 = "";
|
|
|
|
|
2007-02-27 20:03:56 +01:00
|
|
|
if (isset ($_GET["sec"])){
|
|
|
|
$sec = parametro_limpio ($_GET["sec"]);
|
|
|
|
$pagina = $sec2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
$sec = "";
|
2007-04-13 20:47:58 +02:00
|
|
|
// http://es2.php.net/manual/en/ref.session.php#64525
|
|
|
|
// Session locking concurrency speedup!
|
|
|
|
session_write_close();
|
2006-03-27 05:37:27 +02:00
|
|
|
?>
|
2007-02-27 20:03:56 +01:00
|
|
|
|
2007-05-27 04:55:55 +02:00
|
|
|
<div id="container">
|
|
|
|
<div id='head'>
|
|
|
|
<?php require("general/header.php"); ?>
|
2007-05-18 11:29:54 +02:00
|
|
|
</div>
|
2007-05-27 04:55:55 +02:00
|
|
|
<div id="page">
|
|
|
|
<div id="menu">
|
|
|
|
<?php require ("general/main_menu.php"); ?>
|
|
|
|
</div>
|
|
|
|
<div id="main" style="background: url(images/backgrounds/<?php echo $config_bgimage; ?>)" >
|
|
|
|
<?php
|
|
|
|
// Page loader / selector
|
|
|
|
if ($pagina != ""){
|
|
|
|
if (file_exists ($pagina . ".php")) {
|
|
|
|
require ($pagina . ".php");
|
|
|
|
} else {
|
|
|
|
echo "<br><b class='error'>Sorry! I can't find the page!</b>";
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
require ("general/logon_ok.php"); //default
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
<div style="clear:both"></div>
|
|
|
|
</div>
|
|
|
|
<div id="foot">
|
|
|
|
<?php require("general/footer.php") ?>
|
2006-03-27 05:37:27 +02:00
|
|
|
</div>
|
2007-05-18 14:56:05 +02:00
|
|
|
</div>
|
|
|
|
|
2006-03-27 05:37:27 +02:00
|
|
|
</body>
|
2006-12-15 16:25:19 +01:00
|
|
|
</html>
|