mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
This commit is contained in:
@@ -476,7 +476,11 @@ function ImportCSV() {
|
||||
if(isset ($_POST['content']) && !empty ($_POST['content']))
|
||||
{
|
||||
// Decode the Base64 string
|
||||
$data = base64_decode($_POST['content']);
|
||||
// $data = base64_decode($_POST['content']);
|
||||
$data = base64_decode($_POST['content'], true); // The second parameter ensures safe decoding
|
||||
|
||||
// // Ensure the decoded data is treated as UTF-8 text
|
||||
// $data = mb_convert_encoding($data, 'UTF-8', 'UTF-8');
|
||||
|
||||
} else if (file_exists($file)) { // try to get the data form the file
|
||||
|
||||
@@ -488,6 +492,12 @@ function ImportCSV() {
|
||||
|
||||
if($data != "")
|
||||
{
|
||||
// data cleanup - new lines breaking the CSV
|
||||
$data = preg_replace_callback('/"([^"]*)"/', function($matches) {
|
||||
// Replace all \n within the quotes with a space
|
||||
return str_replace("\n", " ", $matches[0]); // Replace with a space
|
||||
}, $data);
|
||||
|
||||
$lines = explode("\n", $data);
|
||||
|
||||
// Get the column headers from the first line of the CSV
|
||||
|
||||
@@ -25,7 +25,7 @@ $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https:
|
||||
$url = $protocol . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
|
||||
$isLogonPage = strpos($url, 'index.php') !== false;
|
||||
$authHeader = apache_request_headers()['Authorization'] ?? '';
|
||||
$sessionLogin = $_SESSION['login'] ?? 0;
|
||||
$sessionLogin = isset($_SESSION['login']) ? $_SESSION['login'] : 0;
|
||||
|
||||
// Start session if not already started
|
||||
if (session_status() == PHP_SESSION_NONE) {
|
||||
|
||||
Reference in New Issue
Block a user