'; // Pure mode (without menu, header and footer). $config["pure"] = (bool) get_parameter ("pure", 0); // Auto Refresh page $config["refr"] = (int) get_parameter ("refr", 0); if ($config["refr"] > 0) { // Agent selection filters and refresh $query = 'http' . (isset ($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == TRUE ? 's': '') . '://' . $_SERVER['SERVER_NAME']; if ($_SERVER['SERVER_PORT'] != 80 && (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == TRUE && $_SERVER['SERVER_PORT'] != 443)) { $query .= ":" . $_SERVER['SERVER_PORT']; } $query .= $_SERVER['SCRIPT_NAME']; if (sizeof ($_REQUEST)) //Some (old) browsers don't like the ?&key=var $query .= '?1=1'; //We don't clean these variables up as they're only being passed along foreach ($_GET as $key => $value) { /* Avoid the 1=1 */ if ($key == 1) continue; $query .= '&'.$key.'='.$value; } foreach ($_POST as $key => $value) { $query .= '&'.$key.'='.$value; } echo ''; } enterprise_include ('index.php'); echo 'Pandora FMS - '.__('the Flexible Monitoring System').' '; enterprise_hook ('load_html_header'); echo ''; // Show custom background if ($config["pure"] == 0) { echo ''; } else { echo ''; } $REMOTE_ADDR = $_SERVER['REMOTE_ADDR']; $config["remote_addr"] = $_SERVER['REMOTE_ADDR']; $sec2 = get_parameter_get ('sec2'); $sec2 = safe_url_extraclean ($sec2); $page = $sec2; //Reference variable for old time sake $sec = get_parameter_get ('sec'); $sec = safe_url_extraclean ($sec); // Hash login process if (! isset ($_SESSION['id_usuario']) && isset ($_GET["loginhash"])) { $loginhash_data = get_parameter("loginhash_data", ""); $loginhash_user = get_parameter("loginhash_user", ""); if ($loginhash_data == md5($loginhash_user.$config["loginhash_pwd"])) { update_user_contact ($loginhash_user); logon_db ($loginhash_user, $REMOTE_ADDR); $_SESSION['id_usuario'] = $loginhash_user; $config["id_user"] = $loginhash_user; } else { require_once ('general/login_page.php'); audit_db ("system", $REMOTE_ADDR, "Logon Failed (loginhash", ""); exit; } } // Login process elseif (! isset ($_SESSION['id_usuario']) && isset ($_GET["login"])) { $config["auth_error"] = ""; //Set this to the error message from the authorization mechanism $nick = get_parameter_post ("nick"); //This is the variable with the login $pass = get_parameter_post ("pass"); //This is the variable with the password // process_user_login is a virtual function which should be defined in each auth file. // It accepts username and password. The rest should be internal to the auth file. // The auth file can set $config["auth_error"] to an informative error output or reference their internal error messages to it // process_user_login should return false in case of errors or invalid login, the nickname if correct $nick = process_user_login ($nick, $pass); if ($nick !== false) { unset ($_GET["sec2"]); $_GET["sec"] = "general/logon_ok"; update_user_contact ($nick); logon_db ($nick, $REMOTE_ADDR); $_SESSION['id_usuario'] = $nick; $config['id_user'] = $nick; //Remove everything that might have to do with people's passwords or logins unset ($_GET['pass'], $pass, $_POST['pass'], $_REQUEST['pass'], $login_good); } else { // User not known $login_failed = true; require_once ('general/login_page.php'); audit_db ($nick, $REMOTE_ADDR, "Logon Failed", "Invalid login: ".$nick); exit; } } elseif (! isset ($_SESSION['id_usuario'])) { // There is no user connected require_once ('general/login_page.php'); echo ''; exit; } else { // There is session for id_usuario $config["id_user"] = $_SESSION["id_usuario"]; } // Log off if (isset ($_GET["bye"])) { include ("general/logoff.php"); $iduser = $_SESSION["id_usuario"]; logoff_db ($iduser, $REMOTE_ADDR); session_unregister ("id_usuario"); exit; } // http://es2.php.net/manual/en/ref.session.php#64525 // Session locking concurrency speedup! session_write_close(); // Header if ($config["pure"] == 0) { echo '
'; } else { echo '
'; } // Main block of content if ($config["pure"] == 0) { echo '
'; } // Page loader / selector if ($page != "") { $page .= '.php'; if (file_exists ($page)) { if (! is_extension ($page)) { require ($page); } else { if ($sec[0] == 'g') { extension_call_godmode_function (basename ($page)); } else { extension_call_main_function (basename ($page)); } } } else { echo '
'.__('Sorry! I can\'t find the page!').''; } } else { if (enterprise_hook ('load_logon_ok') === ENTERPRISE_NOT_HOOK) { require ("general/logon_ok.php"); } } if ($config["pure"] == 0) { echo '
'; // main echo '
 
'; echo '
'; // page (id = page) } else { echo "
"; // main_pure } if ($config["pure"] == 0) { echo ''; echo '
'; } echo ''; ?>