fixed errors session_start

This commit is contained in:
daniel 2018-11-21 13:08:58 +01:00
parent 3f6384c690
commit 494b858a20
26 changed files with 89 additions and 132 deletions

View File

@ -18,9 +18,8 @@ if ((! file_exists("include/config.php")) || (! is_readable("include/config.php"
exit;
}
// Real start
session_start();
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ('include/config.php');
require_once ('include/functions.php');
require_once ('include/functions_db.php');
@ -82,7 +81,6 @@ if (isset($config['metaconsole'])) {
if ($config['metaconsole'])
define ('METACONSOLE', true);
}
session_write_close ();
if (file_exists ($page)) {
require_once ($page);

View File

@ -16,14 +16,14 @@
if (isset($_GET['get_ptr'])) {
if ($_GET['get_ptr'] == 1) {
session_start ();
session_write_close ();
$ownDir = dirname(__FILE__) . '/';
$ownDir = str_replace("\\", "/", $ownDir);
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ($ownDir.'../include/config.php');
// Login check
if (!isset($_SESSION["id_usuario"])) {
$config['id_user'] = null;

View File

@ -14,8 +14,10 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ("../include/config.php");
require_once ("../include/functions.php");
require_once ("../include/functions_html.php");
?>
@ -33,11 +35,6 @@ require_once ("../include/functions_html.php");
$id = get_parameter ('id');
$id_user = get_parameter ('id_user');
if (! isset($_SESSION['id_usuario'])) {
session_start();
session_write_close();
}
$user_language = get_user_language ($id_user);
if (file_exists ('../include/languages/'.$user_language.'.mo')) {

View File

@ -13,9 +13,10 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
session_start ();
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ("../../include/config.php");
require_once ("../../include/functions.php");
require_once ("../../include/functions_db.php");
require_once ("../../include/functions_users.php");

View File

@ -12,19 +12,17 @@
$ownDir = dirname(__FILE__) . '/';
$ownDir = str_replace("\\", "/", $ownDir);
require_once($ownDir . "../include/config.php");
require_once($config["homedir"] . "/include/functions.php");
require_once($config["homedir"] . "/include/functions_db.php");
require_once($config["homedir"] . "/include/auth/mysql.php");
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ($ownDir . "../include/config.php");
require_once ($config["homedir"] . "/include/functions.php");
require_once ($config["homedir"] . "/include/functions_db.php");
require_once ($config["homedir"] . "/include/auth/mysql.php");
global $config;
if (! isset($_SESSION["id_usuario"])) {
session_start();
session_write_close();
}
// Login check
if (!isset($_SESSION["id_usuario"])) {
$config['id_user'] = null;

View File

@ -76,14 +76,6 @@ if (isInACL($ipOrigin)) {
if ($user_in_db !== false) {
$config['id_user'] = $user_in_db;
$correctLogin = true;
//XXXX
session_start();
$_SESSION["id_usuario"] = $user;
session_write_close();
file_put_contents(session_save_path() . DIRECTORY_SEPARATOR . "pansess_" . session_id(), $user);
}
else {
$no_login_msg = "Incorrect user credentials";

View File

@ -13,17 +13,8 @@
// GNU General Public License for more details.
// Global & session manageme
session_id($_REQUEST["session_id"]);
if (file_exists(session_save_path() . "/pansess_" . session_id()) ) {
$user = file_get_contents(session_save_path() . "/pansess_" . session_id());
}
session_start();
if (isset($user)) {
$_SESSION["id_usuario"] = $user;
}
session_write_close();
require_once ('config.php');
require_once ($config['homedir'] . '/include/auth/mysql.php');

View File

@ -1787,10 +1787,7 @@ function check_login ($output = true) {
}
else {
require_once($config["homedir"].'/mobile/include/user.class.php');
if(session_id() == '') {
session_start ();
}
session_write_close ();
if (isset($_SESSION['user'])) {
$user = $_SESSION['user'];
$id_user = $user->getIdUser();
@ -3372,7 +3369,7 @@ function get_copyright_notice () {
*/
function generate_csrf_code() {
// Start session to make this var permanent
session_start();
if (session_status() === PHP_SESSION_NONE) session_start();
$_SESSION['csrf_code'] = md5(uniqid(mt_rand(), true));
session_write_close();
return $_SESSION['csrf_code'];

View File

@ -320,25 +320,33 @@ function reporting_make_reporting_data($report = null, $id_report,
$report['contents'][] = reporting_value(
$report,
$content,
'max',$pdf);
'max',
$pdf
);
break;
case 'avg_value':
$report['contents'][] = reporting_value(
$report,
$content,
'avg',$pdf);
'avg',
$pdf
);
break;
case 'min_value':
$report['contents'][] = reporting_value(
$report,
$content,
'min',$pdf);
'min',
$pdf
);
break;
case 'sumatory':
$report['contents'][] = reporting_value(
$report,
$content,
'sum');
'sum',
$pdf
);
break;
case 'historical_data':
$report['contents'][] = reporting_historical_data(
@ -349,25 +357,33 @@ function reporting_make_reporting_data($report = null, $id_report,
$report['contents'][] = reporting_value(
$report,
$content,
'MTTR');
'MTTR',
$pdf
);
break;
case 'MTBF':
$report['contents'][] = reporting_value(
$report,
$content,
'MTBF');
'MTBF',
$pdf
);
break;
case 'TTO':
$report['contents'][] = reporting_value(
$report,
$content,
'TTO');
'TTO',
$pdf
);
break;
case 'TTRT':
$report['contents'][] = reporting_value(
$report,
$content,
'TTRT');
'TTRT',
$pdf
);
break;
case 'agent_configuration':
$report['contents'][] = reporting_agent_configuration(
@ -3774,7 +3790,7 @@ function reporting_agent_configuration($report, $content) {
return reporting_check_structure_content($return);
}
function reporting_value($report, $content, $type,$pdf) {
function reporting_value($report, $content, $type, $pdf) {
global $config;
$return = array();

View File

@ -13,13 +13,14 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
if (! isset($_SESSION['id_usuario'])) {
session_start();
}
require_once('functions.php');
require_once('functions_filemanager.php');
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ("config.php");
require_once ('functions.php');
require_once ('functions_filemanager.php');
global $config;
check_login ();

View File

@ -35,15 +35,15 @@ function pandora_session_read ($session_id) {
function pandora_session_write ($session_id, $data) {
$session_id = addslashes($session_id);
$values = array();
$values['last_active'] = time();
if (!empty($data))
$values['data'] = addslashes($data);
$session_exists = (bool) db_get_value('COUNT(id_session)', 'tsessions_php', 'id_session', $session_id);
if (!$session_exists) {
$values['id_session'] = $session_id;
$retval_write = db_process_sql_insert('tsessions_php', $values);
@ -52,7 +52,7 @@ function pandora_session_write ($session_id, $data) {
$retval_write = db_process_sql_update('tsessions_php', $values, array('id_session' => $session_id));
}
return ($retval_write !== false) ? true : false;
return $retval_write !== false;
}
function pandora_session_destroy ($session_id) {

View File

@ -810,7 +810,7 @@ if (isset ($_GET["bye"])) {
include ("general/logoff.php");
$iduser = $_SESSION["id_usuario"];
db_logoff ($iduser, $_SERVER['REMOTE_ADDR']);
// Unregister Session (compatible with 5.2 and 6.x, old code was deprecated
$_SESSION = array();
session_destroy();
header_remove("Set-Cookie");

View File

@ -19,14 +19,13 @@ if (function_exists ('mb_internal_encoding')) {
}
$develop_bypass = 0;
require_once '../include/config.php';
require_once("include/ui.class.php");
require_once("include/system.class.php");
require_once("include/db.class.php");
require_once("include/user.class.php");
require_once('../include/config.php');
require_once('operation/home.php');
require_once('operation/tactical.php');
require_once('operation/groups.php');

View File

@ -13,12 +13,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
if (! isset($_SESSION['id_usuario'])) {
session_start();
}
// Global & session management
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once('../../include/config.php');
require_once($config['homedir'] . '/include/functions.php');

View File

@ -13,8 +13,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
session_start ();
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ("../../include/config.php");
require_once ("../../include/functions.php");
require_once ("../../include/functions_db.php");

View File

@ -13,8 +13,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
session_start ();
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ("../../include/config.php");
require_once ("../../include/functions_agents.php");
require_once ("../../include/functions_reporting.php");

View File

@ -13,8 +13,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
session_start ();
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ("../../include/config.php");
require_once ("../../include/functions_agents.php");
require_once ("../../include/functions_reporting.php");

View File

@ -13,13 +13,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
if (! isset($_SESSION['id_usuario'])) {
session_start();
session_write_close();
}
// Global & session management
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ('../../include/config.php');
require_once ($config['homedir'] . '/include/auth/mysql.php');
require_once ($config['homedir'] . '/include/functions.php');
@ -30,7 +25,7 @@ require_once ($config['homedir'] . '/include/functions_custom_graphs.php');
require_once ($config['homedir'] . '/include/functions_modules.php');
require_once ($config['homedir'] . '/include/functions_agents.php');
require_once ($config['homedir'] . '/include/functions_tags.php');
enterprise_include_once('include/functions_agents.php');
enterprise_include_once ('include/functions_agents.php');
check_login();

View File

@ -13,13 +13,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
if (! isset($_SESSION['id_usuario'])) {
session_start();
//session_write_close();
}
// Global & session management
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ('../../include/config.php');
require_once ($config['homedir'] . '/include/auth/mysql.php');
require_once ($config['homedir'] . '/include/functions.php');

View File

@ -13,12 +13,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
if (! isset($_SESSION['id_usuario'])) {
session_start();
//session_write_close();
}
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ('../../include/config.php');
require_once ($config['homedir'] . '/include/auth/mysql.php');
require_once ($config['homedir'] . '/include/functions.php');

View File

@ -13,13 +13,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
if (! isset($_SESSION['id_usuario'])) {
session_start();
//session_write_close();
}
// Global & session management
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ('../../include/config.php');
require_once ($config['homedir'] . '/include/auth/mysql.php');
require_once ($config['homedir'] . '/include/functions.php');

View File

@ -13,18 +13,18 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
session_start ();
error_reporting(1);
// Local settings for marquee extension
$MAX_MARQUEE_EVENTS=10;
$MARQUEE_INTERVAL=90;
$MARQUEE_FONT_SIZE="32px";
$MARQUEE_SPEED=12;
$output = "";
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once "../../include/config.php";
require_once "../../include/functions.php";
require_once "../../include/functions_db.php";

View File

@ -13,8 +13,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
session_start();
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ("../../include/config.php");
require_once ("../../include/auth/mysql.php");
require_once ("../../include/functions.php");
@ -23,8 +23,6 @@ require_once ("../../include/functions_events.php");
require_once ("../../include/functions_agents.php");
require_once ('../../include/functions_groups.php');
session_write_close ();
$config["id_user"] = $_SESSION["id_usuario"];
if (! check_acl ($config["id_user"], 0, "ER") && ! check_acl ($config["id_user"], 0, "EW") && ! check_acl ($config["id_user"], 0, "EM")) {

View File

@ -13,14 +13,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Real start
session_start ();
// Load global vars
if ((! file_exists("../../include/config.php")) || (! is_readable("../../include/config.php"))) {
exit;
}
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ('../../include/config.php');
require_once ('../../include/functions.php');
require_once ('../../include/functions_db.php');

View File

@ -12,14 +12,13 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Real start
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ("../../include/config.php");
// Set root on homedir, as defined in setup
chdir ($config["homedir"]);
session_start ();
ob_start ();
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n";
echo '<html xmlns="http://www.w3.org/1999/xhtml">'."\n";

View File

@ -13,14 +13,13 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Real start
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ("../../include/config.php");
// Set root on homedir, as defined in setup
chdir ($config["homedir"]);
session_start ();
ob_start ();
/* Enterprise support */
if (file_exists (ENTERPRISE_DIR . "/load_enterprise.php")) {