mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
chore: 🧹Removal of DB backups functionality
This commit is contained in:
@@ -19,9 +19,9 @@ $config_file = "../../../config/app.conf"; // depends on where this file is call
|
||||
$config_file_lines = file($config_file);
|
||||
$config_file_lines = array_values(preg_grep('/^SETPWD_password.*=/', $config_file_lines));
|
||||
$password_line = explode("'", $config_file_lines[0]);
|
||||
$Pia_Password = $password_line[1];
|
||||
$nax_Password = $password_line[1];
|
||||
|
||||
if (isset($_COOKIE[$CookieSaveLoginName]) && $Pia_Password == $_COOKIE[$CookieSaveLoginName]) {
|
||||
if (isset($_COOKIE[$CookieSaveLoginName]) && $nax_Password == $_COOKIE[$CookieSaveLoginName]) {
|
||||
$isAuthenticated = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ if(array_search('action', $_REQUEST) != FALSE)
|
||||
session_destroy();
|
||||
setcookie($CookieSaveLoginName, "", time() - 3600);
|
||||
header('Location: index.php');
|
||||
exit(); // ensure script stops after header redirection
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,43 +29,65 @@ if(array_search('action', $_REQUEST) != FALSE)
|
||||
// ## Login Processing start
|
||||
// ##################################################
|
||||
$config_file = $_SERVER['DOCUMENT_ROOT'] . "/../config/app.conf";
|
||||
$config_file_lines = file($config_file);
|
||||
|
||||
if (file_exists($config_file)) {
|
||||
$config_file_lines = file($config_file);
|
||||
} else {
|
||||
// handle missing config file
|
||||
die("Configuration file not found.");
|
||||
}
|
||||
|
||||
$CookieSaveLoginName = "NetAlertX_SaveLogin";
|
||||
|
||||
// ###################################
|
||||
// ## SETPWD_enable_password FALSE
|
||||
// ###################################
|
||||
|
||||
// Find SETPWD_enable_password line
|
||||
$config_file_lines_bypass = array_values(preg_grep('/^SETPWD_enable_password.*=/', $config_file_lines));
|
||||
$protection_line = explode("=", $config_file_lines_bypass[0]);
|
||||
$Pia_WebProtection = strtolower(trim($protection_line[1]));
|
||||
|
||||
if (!empty($config_file_lines_bypass)) {
|
||||
$protection_line = explode("=", $config_file_lines_bypass[0]);
|
||||
$nax_WebProtection = strtolower(trim($protection_line[1]));
|
||||
} else {
|
||||
// Default behavior if SETPWD_enable_password is not found
|
||||
$nax_WebProtection = 'false'; // or another default value
|
||||
}
|
||||
|
||||
// ###################################
|
||||
// ## SETPWD_enable_password TRUE
|
||||
// ###################################
|
||||
|
||||
$config_file_lines = array_values(preg_grep('/^SETPWD_password.*=/', $config_file_lines));
|
||||
$password_line = explode("'", $config_file_lines[0]);
|
||||
$Pia_Password = $password_line[1];
|
||||
// Find SETPWD_password line
|
||||
$config_file_lines_password = array_values(preg_grep('/^SETPWD_password.*=/', $config_file_lines));
|
||||
|
||||
if (!empty($config_file_lines_password)) {
|
||||
$password_line = explode("'", $config_file_lines_password[0]);
|
||||
$nax_Password = $password_line[1];
|
||||
} else {
|
||||
// Default behavior if SETPWD_password is not found
|
||||
$nax_Password = ''; // or handle accordingly
|
||||
}
|
||||
|
||||
// active Session or valid cookie (cookie not extends)
|
||||
if($Pia_WebProtection == 'true')
|
||||
if($nax_WebProtection == 'true')
|
||||
{
|
||||
if(isset ($_SESSION["login"]) == FALSE )
|
||||
if(isset($_SESSION["login"]) == FALSE )
|
||||
{
|
||||
$_SESSION["login"] = 0;
|
||||
}
|
||||
|
||||
if ( ($_SESSION["login"] == 1) || $isLogonPage || (( isset($_COOKIE[$CookieSaveLoginName]) && $Pia_Password == $_COOKIE[$CookieSaveLoginName ])))
|
||||
if ($_SESSION["login"] == 1 || $isLogonPage || (isset($_COOKIE[$CookieSaveLoginName]) && $nax_Password == $_COOKIE[$CookieSaveLoginName]))
|
||||
{
|
||||
//Logged in or stay on this page if we are on the index.php already
|
||||
// Logged in or stay on this page if we are on the index.php already
|
||||
|
||||
} else
|
||||
{
|
||||
// we need to redirect
|
||||
header('Location: /index.php');
|
||||
exit(); // ensure script stops after header redirection
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user