Jump to content

ohno

Members
  • Posts

    127
  • Joined

  • Last visited

  • Days Won

    1

ohno last won the day on March 28 2020

ohno had the most liked content!

ohno's Achievements

Advanced Member

Advanced Member (4/5)

2

Reputation

  1. I wasn't sure if this should be in the JS/AJAX section or PHP,as the JS part seems OK I guess here! I have this at the very top of my script : - // Get the data from the AJAX request $searchQuery = isset($_POST['searchQuery']) ? $_POST['searchQuery'] : ''; $sessionid = isset($_POST['sessionid']) ? $_POST['sessionid'] : ''; // Declare as global variables // tried, no change // global $searchQuery, $sessionid; // Log the data to a text file $logData = "Received data from JavaScript:\n"; $logData .= "Search Query: " . $searchQuery . "\n"; $logData .= "Session ID: " . $sessionid . "\n\n"; $logFilePath = __DIR__ . '/log.txt'; file_put_contents($logFilePath, $logData, FILE_APPEND); This is working fine as I have checked the log file, so the payload is received OK. I then have this code lower down in my script : // Check if $searchQuery and $sessionid are not empty if (!empty($searchQuery) && !empty($sessionid)) { // Check if the sessionid from the database matches the sessionid from the AJAX payload if ($data['sessionid'] == $sessionid) { echo '<td class="center">***** ' . $searchQuery . ' *****</td>'; } else { echo '<td class="center">No search query available</td>'; } } else { echo '<td class="center">Missing search query or session ID</td>'; } // End With the above I get nothing, If I hard code a `sessionid` and a search term it appears in my HTML table for the correct user. Ie, with this it "works" : $searchQuery = 'This is where the data should appear!!'; $sessionid = '28if81v4amdsl7qlh5f5ktvc1r'; // Check if $searchQuery and $sessionid are not empty if (!empty($searchQuery) && !empty($sessionid)) { // Check if the sessionid from the database matches the sessionid from the AJAX payload if ($data['sessionid'] == $sessionid) { echo '<td class="center">***** ' . $searchQuery . ' *****</td>'; } else { echo '<td class="center">No search query available</td>'; } } else { echo '<td class="center">Missing search query or session ID</td>'; } // End Why can I not use the variables set at the top of my page? Or, how can I fix this?! Thanks for any help
  2. This works with all error scenarios..but doesn't actually update the database when the correct file is selected! <?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); $site_root = 'https://'.$_SERVER['SERVER_NAME']; // check maximum upload size $max_upload = (int)(ini_get('upload_max_filesize')); $max_post = (int)(ini_get('post_max_size')); $max_size = min($max_upload, $max_post); $max_size_bytes = $max_size * 1024 * 1024; // server size in bytes $style = ' <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> <style> .button { background-color: #00A5FF; border-radius: 4px; border: none; color: white; padding: 15px 32px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; cursor: pointer; } </style> <title>ERROR DETECTED!</title> '; $postMaxSize = trim(ini_get('post_max_size')); if (strlen($postMaxSize)>0) { $postMaxSizeValue = substr($postMaxSize, 0, -1); $postMaxSizeUnit = strtolower(substr($postMaxSize, -1)); $postMaxSize = 0; if (false !== filter_var($postMaxSizeValue, FILTER_VALIDATE_INT, array('options' => array( 'min_range' => 0)))) { switch ($postMaxSizeUnit) { case 'g': $postMaxSizeValue*=1024; case 'm': $postMaxSizeValue*=1024; case 'k': $postMaxSizeValue*=1024; break; default: if ($postMaxSizeUnit>='0' && $postMaxSizeUnit<='9') { $postMaxSizeValue = (int) $postMaxSizeValue.$postMaxSizeUnit; } else { $postMaxSizeValue = 0; } } $postMaxSize = $postMaxSizeValue; } } else { $postMaxSize = 0; } if (empty($_FILES) && empty($_POST) && isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['CONTENT_LENGTH'] > $postMaxSize) { echo "<center><img src='".$site_root."/images/cartwarningred.png' alt='Error!' />&nbsp;&nbsp;<b>The uploaded file exceeds the maximum post file size. Maximum post file size allowed is ".$max_post." MB (".$postMaxSize." bytes)<br><br />Increase 'post_max_size' setting on the server!</b></center>"; echo "<center><a href='javascript:window.history.back();'><button class='button'>BACK!</button></a></center>"; echo $style; exit(1); } // display maximum upload size echo "<center><b>Maximum Upload File Size: $max_upload MB</b></center>"; echo "<center><b>Maximum Post Size: $max_post MB</b></center>"; echo "<center><b>Maximum Size Bytes: $max_size_bytes</b></center>"; if (isset($_FILES["file"])) { $fileName = $_FILES["file"]["tmp_name"]; $fileType = $_FILES["file"]["type"]; $allowedTypes = array('text/csv', 'application/vnd.ms-excel'); if ($_FILES["file"]["error"] !== UPLOAD_ERR_OK) { $error_message = ''; switch ($_FILES["file"]["error"]) { case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: $error_message = "The uploaded file exceeds the maximum file size. Maximum file size allowed is $max_size MB<br />Increase 'upload_max_filesize' setting on the server!"; break; case UPLOAD_ERR_PARTIAL: $error_message = "The uploaded file was only partially uploaded."; break; case UPLOAD_ERR_NO_FILE: $error_message = "No file selected, no file was uploaded."; break; case UPLOAD_ERR_NO_TMP_DIR: $error_message = "Missing a temporary folder."; break; case UPLOAD_ERR_CANT_WRITE: $error_message = "Failed to write file to disk."; break; case UPLOAD_ERR_EXTENSION: $error_message = "File upload stopped by extension."; break; default: $error_message = "Unknown upload error."; break; } echo "<center><img src='".$site_root."/images/cartwarningred.png' alt='Error!' />&nbsp;&nbsp;<b>File upload failed with nnerror: ".$error_message."</b></center>"; echo "<center><a href='javascript:window.history.back();'><button class='button'>BACK!</button></a></center>"; echo $style; exit; } else if (!in_array($fileType, $allowedTypes)) { echo "<center><img src='".$site_root."/images/cartwarningred.png' alt='Error!' />&nbsp;&nbsp;<b>File upload failed with error: Only CSV files are allowed</b></center>"; echo "<center><a href='javascript:window.history.back();'><button class='button'>BACK!</button></a></center>"; echo $style; exit; } else { $file = fopen($fileName, "r"); } } class ImportController { private $conn; // getting connection in constructor function __construct($conn) { $this->conn = $conn; } // function for reading csv file public function index() { $fileName = ""; // if there is any file if(isset($_FILES['file'])) { // reading tmp_file name $fileName = $_FILES["file"]["tmp_name"]; } $counter = 0; // if file size is not empty if (isset($_FILES["file"]) && $_FILES["file"]["size"] > 0) { $file = fopen($fileName, "r"); // eliminating the first row of CSV file fgetcsv($file); ?> <table class="table"> <thead> <th> IP From </th> <th> IP To </th> <th> Country Code </th> <th> Country Name </th> <th> Response </th> </thead> <?php // prepare the statement $stmt = $this->conn->prepare("REPLACE INTO ip2location (ip_from, ip_to, country_code, country_name) VALUES (?, ?, ?, ?)"); while (($column = fgetcsv($file, 10000, ",")) !== FALSE) { $counter++; // assigning csv column to a variable $ip_from = $column[0]; $ip_to = $column[1]; $country_code = $column[2]; $country_name = $column[3]; // bind the values to the statement parameters and execute $stmt->bind_param("ssss", $ip_from, $ip_to, $country_code, $country_name); $result = $stmt->execute(); if($result == 1): ?> <tr> <td> <?php echo $ip_from; ?> </td> <td> <?php echo $ip_to; ?> </td> <td> <?php echo $country_code; ?> </td> <td> <?php echo $country_name; ?> </td> <td> <?php echo "<label class='text-success'>Success </label> " .date('d-m-Y H:i:s');?> </td> </tr> <?php endif; } $stmt->close(); // close the statement ?> </table> <?php } } } ?> <!DOCTYPE html> <html> <head> <style> .button { background-color: #00A5FF; border-radius: 4px; border: none; color: white; padding: 15px 32px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; cursor: pointer; } </style> <title>Import IP Location Database CSV</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> </head> <body> <p style="text-align:center">Upload New Cart IP Geo Tracking Database Here. This Will Import IP Info In CSV Format!</p> <div class="row"> <div class="col-md-10 offset-md-5"> <a href="https://lite.ip2location.com/ip2location-lite" target="_blank"><button class="button">Download New DB!</button></a> <a href="<?php echo $site_root; ?>/cartsystem/admin/orders.php"><button class="button">BACK!</button></a> </div> </div> <div class="container"> <form method="post" enctype="multipart/form-data"> <div class="row mt-5"> <div class="col-md-6 m-auto border shadow"> <label> Import Data - CAUTION! This Affects LIVE Site!</label> <div class="form-group"> <input type="file" name="file" class="form-control"> </div> <div class="form-group"> <button type="submit" name="import" class="btn btn-success"> Import Data </button> </div> </div> </div> <div class="row mt-4"> <div class="col-md-10 m-auto"> <?php if (isset($importResult)) { echo $importResult; } ?> </div> </div> </form> </div> </body> </html>
  3. I think I'll need to merge the two files to get this to work but not sure how? Current form page (I tried adding the error checking here, it didn't work) : - <?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); $site_root = 'https://'.$_SERVER['SERVER_NAME']; // including db config file include_once("../db-config.php"); // including import controller file include_once("../import-controller.php"); // creating object of DBController class $db = new DBController(); // calling connect() function using object $conn = $db->connect(); // creating object of import controller and passing connection object as a parameter $importCtrl = new ImportController($conn); ?> <!DOCTYPE html> <html> <head> <style> .button { background-color: #00A5FF; border-radius: 4px; border: none; color: white; padding: 15px 32px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; cursor: pointer; } </style> <title>Import IP Location Database CSV</title> </head> <body> <p style="text-align:center">Upload New Cart IP Geo Tracking Database Here. This Will Import IP Info In CSV Format!</p> <div class="row"> <div class="col-md-10 offset-md-5"> <a href="https://lite.ip2location.com/ip2location-lite" target="_blank"><button class="button">Download New DB!</button></a> <a href="<?php echo $site_root; ?>/cartsystem/admin/orders.php"><button class="button">BACK!</button></a> </div> </div> <div class="container"> <?php if ($_SERVER['REQUEST_METHOD'] === 'POST') { $file_size = $_FILES['file']['size']; $max_size = 1024 * 1024; // 1 MB if ($file_size > $max_size) { echo '<div class="alert alert-danger">The uploaded file is too large (max size: 1MB).</div>'; } else { $importResult = $importCtrl->index(); } } ?> <form method="post" enctype="multipart/form-data"> <div class="row mt-5"> <div class="col-md-6 m-auto border shadow"> <label> Import Data - CAUTION! This Affects LIVE Site!</label> <div class="form-group"> <input type="file" name="file" class="form-control"> </div> <div class="form-group"> <button type="submit" name="import" class="btn btn-success"> Import Data </button> </div> </div> </div> <div class="row mt-4"> <div class="col-md-10 m-auto"> <?php if (isset($importResult)) { echo $importResult; } ?> </div> </div> </form> </div> </body> </html> and the current import-controller file (again, with added error checking, again, it didn't work) <?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); $site_root = 'https://'.$_SERVER['SERVER_NAME']; // check maximum upload size $max_upload = (int)(ini_get('upload_max_filesize')); $max_post = (int)(ini_get('post_max_size')); $max_size = min($max_upload, $max_post); $max_size_bytes = $max_size * 1024 * 1024; // server size in bytes if ($_SERVER['REQUEST_METHOD'] === 'POST' && empty($_POST) && empty($_FILES)) { // Post data exceeds the maximum post size limit echo "<center><img src='".$site_root."/images/cartwarningred.png' alt='Error!' />&nbsp;&nbsp;<b>Post data exceeds the maximum post size limit of $max_post MB. Please contact your server administrator to increase the limit.</b></center>"; echo "<center><a href='javascript:window.history.back();'><button class='button'>BACK!</button></a></center>"; echo $style; exit; } // display maximum upload size echo "<center><b>Maximum Upload File Size: $max_upload MB</b></center>"; echo "<center><b>Maximum Post Size: $max_post MB</b></center>"; echo "<center><b>Maximum Size Bytes: $max_size_bytes</b></center>"; $style = '<style> .button { background-color: #00A5FF; border-radius: 4px; border: none; color: white; padding: 15px 32px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; cursor: pointer; } </style> <title>ERROR DETECTED!</title> '; if (isset($_FILES["file"])) { $fileName = $_FILES["file"]["tmp_name"]; $fileType = $_FILES["file"]["type"]; $allowedTypes = array('text/csv', 'application/vnd.ms-excel'); if ($_FILES["file"]["error"] !== UPLOAD_ERR_OK) { $error_message = ''; switch ($_FILES["file"]["error"]) { case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: $error_message = "The uploaded file exceeds the maximum file size. Maximum file size allowed is $max_size MB"; break; case UPLOAD_ERR_PARTIAL: $error_message = "The uploaded file was only partially uploaded."; break; case UPLOAD_ERR_NO_FILE: $error_message = "No file selected, no file was uploaded."; break; case UPLOAD_ERR_NO_TMP_DIR: $error_message = "Missing a temporary folder."; break; case UPLOAD_ERR_CANT_WRITE: $error_message = "Failed to write file to disk."; break; case UPLOAD_ERR_EXTENSION: $error_message = "File upload stopped by extension."; break; default: $error_message = "Unknown upload error."; break; } echo "<center><img src='".$site_root."/images/cartwarningred.png' alt='Error!' />&nbsp;&nbsp;<b>File upload failed with error: ".$error_message."</b></center>"; echo "<center><a href='javascript:window.history.back();'><button class='button'>BACK!</button></a></center>"; echo $style; exit; } else if (!in_array($fileType, $allowedTypes)) { echo "<center><img src='".$site_root."/images/cartwarningred.png' alt='Error!' />&nbsp;&nbsp;<b>File upload failed with error: Only CSV files are allowed</b></center>"; echo "<center><a href='javascript:window.history.back();'><button class='button'>BACK!</button></a></center>"; echo $style; exit; } else if ($_FILES["file"]["size"] > $max_size * 1024 * 1024) { echo "<center><img src='".$site_root."/images/cartwarningred.png' alt='Error!' />&nbsp;&nbsp;<b>File upload failed with error: The uploaded file exceeds the maximum file size. Maximum file size allowed is $max_size MB</b></center>"; echo "<center><a href='javascript:window.history.back();'><button class='button'>BACK!</button></a></center>"; echo $style; exit; } else { $file = fopen($fileName, "r"); } } class ImportController { private $conn; // getting connection in constructor function __construct($conn) { $this->conn = $conn; } // function for reading csv file public function index() { $fileName = ""; // if there is any file if(isset($_FILES['file'])) { // reading tmp_file name $fileName = $_FILES["file"]["tmp_name"]; } $counter = 0; // if file size is not empty if (isset($_FILES["file"]) && $_FILES["file"]["size"] > 0) { $file = fopen($fileName, "r"); // eliminating the first row of CSV file fgetcsv($file); ?> <table class="table"> <thead> <th> IP From </th> <th> IP To </th> <th> Country Code </th> <th> Country Name </th> <th> Response </th> </thead> <?php // prepare the statement $stmt = $this->conn->prepare("REPLACE INTO ip2location (ip_from, ip_to, country_code, country_name) VALUES (?, ?, ?, ?)"); while (($column = fgetcsv($file, 10000, ",")) !== FALSE) { $counter++; // assigning csv column to a variable $ip_from = $column[0]; $ip_to = $column[1]; $country_code = $column[2]; $country_name = $column[3]; // bind the values to the statement parameters and execute $stmt->bind_param("ssss", $ip_from, $ip_to, $country_code, $country_name); $result = $stmt->execute(); if($result == 1): ?> <tr> <td> <?php echo $ip_from; ?> </td> <td> <?php echo $ip_to; ?> </td> <td> <?php echo $country_code; ?> </td> <td> <?php echo $country_name; ?> </td> <td> <?php echo "<label class='text-success'>Success </label> " .date('d-m-Y H:i:s');?> </td> </tr> <?php endif; } $stmt->close(); // close the statement ?> </table> <?php } } } ?> If anyone has the time to take a look and post what code is required it would be much appreciated!
  4. I have this code : - <?php $site_root = 'https://'.$_SERVER['SERVER_NAME']; // check maximum upload size $max_upload = (int)(ini_get('upload_max_filesize')); $max_post = (int)(ini_get('post_max_size')); $max_size = min($max_upload, $max_post); $max_size_bytes = $max_size * 1024 * 1024; // server size in bytes // display maximum upload size echo "<center><b>Maximum Upload File Size: $max_size MB</b></center>"; echo "<center><b>Maximum Post Size: $max_post MB</b></center>"; echo "<center><b>Maximum Size Bytes: $max_size_bytes</b></center>"; $style = '<style> .button { background-color: #00A5FF; border-radius: 4px; border: none; color: white; padding: 15px 32px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; cursor: pointer; } </style> <title>ERROR DETECTED!</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> '; // error checking if (isset($_FILES["file"])) { $fileName = $_FILES["file"]["tmp_name"]; $fileType = $_FILES["file"]["type"]; $allowedTypes = array('text/csv', 'application/vnd.ms-excel'); if ($_FILES["file"]["error"] !== UPLOAD_ERR_OK) { echo "<center><img src='".$site_root."/images/cartwarningred.png' alt='Error!' />&nbsp;&nbsp;<b>File upload failed with error: "; echo $style; switch ($_FILES["file"]["error"]) { case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: echo "The uploaded file exceeds the maximum file size. Maximum file size allowed is $max_size MB"; echo "<a href='javascript:window.history.back();'><button class='button'>BACK!</button></a>"; echo $style; break; case UPLOAD_ERR_PARTIAL: echo "The uploaded file was only partially uploaded."; echo "<a href='javascript:window.history.back();'><button class='button'>BACK!</button></a>"; echo $style; break; case UPLOAD_ERR_NO_FILE: echo "No file selected, no file was uploaded."; echo "<center><a href='javascript:window.history.back();'><button class='button'>BACK!</button></a></center>"; echo $style; break; case UPLOAD_ERR_NO_TMP_DIR: echo "Missing a temporary folder."; echo "<center><a href='javascript:window.history.back();'><button class='button'>BACK!</button></a></center>"; echo $style; break; case UPLOAD_ERR_CANT_WRITE: echo "Failed to write file to disk."; echo "<center><a href='javascript:window.history.back();'><button class='button'>BACK!</button></a></center>"; echo $style; break; case UPLOAD_ERR_EXTENSION: echo "File upload stopped by extension."; echo "<center><a href='javascript:window.history.back();'><button class='button'>BACK!</button></a></center>"; echo $style; break; default: echo "Unknown upload error."; echo "<center><a href='javascript:window.history.back();'><button class='button'>BACK!</button></a></center>"; echo $style; break; } echo "</b></center>"; exit; } else if (!in_array($fileType, $allowedTypes)) { echo "<center><img src='".$site_root."/images/cartwarningred.png' alt='Error!' />&nbsp;&nbsp;<b>File upload failed with error: Only CSV files are allowed</b></center>"; echo "<center><a href='javascript:window.history.back();'><button class='button'>BACK!</button></a></center>"; echo $style; exit; } else { $file = fopen($fileName, "r"); } } class ImportController { // getting connection in constructor function __construct($conn) { $this->conn = $conn; } // function for reading csv file public function index() { $fileName = ""; // if there is any file if(isset($_FILES['file'])) { // reading tmp_file name $fileName = $_FILES["file"]["tmp_name"]; } $counter = 0; // if file size is not empty if (isset($_FILES["file"]) && $_FILES["file"]["size"] > 0) { $file = fopen($fileName, "r"); // eliminating the first row of CSV file fgetcsv($file); ?> <table class="table"> <thead> <th> IP From </th> <th> IP To </th> <th> Country Code </th> <th> Country Name </th> <th> Response </th> </thead> <?php // prepare the statement $stmt = $this->conn->prepare("REPLACE INTO ip2location (ip_from, ip_to, country_code, country_name) VALUES (?, ?, ?, ?)"); while (($column = fgetcsv($file, 10000, ",")) !== FALSE) { $counter++; // assigning csv column to a variable $ip_from = $column[0]; $ip_to = $column[1]; $country_code = $column[2]; $country_name = $column[3]; // bind the values to the statement parameters and execute $stmt->bind_param("ssss", $ip_from, $ip_to, $country_code, $country_name); $result = $stmt->execute(); if($result == 1): ?> <tr> <td> <?php echo $ip_from; ?> </td> <td> <?php echo $ip_to; ?> </td> <td> <?php echo $country_code; ?> </td> <td> <?php echo $country_name; ?> </td> <td> <?php echo "<label class='text-success'>Success </label> " .date('d-m-Y H:i:s');?> </td> </tr> <?php endif; } $stmt->close(); // close the statement ?> </table> <?php } } } ?> During testing if post_max_size is too small but upload_max_filesize is not it tries to upload but fails, I get no error. If post_max_size is OK but upload_max_filesize is not it tries to upload & correctly displays the error "The uploaded file exceeds the maximum file size." How can I get it to display an error if the post_max_size setting on the server is too small?
  5. How does this look? $hash = substr(md5(Server::$Response->Typing),0,5); if (!is_null($hash) && isset($_POST["p_gl_t"]) && $hash != $_POST["p_gl_t"] && strlen(Server::$Response->Typing) > 0) { Server::$Response->XML .= "<gl_typ h=\"".base64_encode($hash)."\">\r\n" . Server::$Response->Typing . "</gl_typ>\r\n"; }
  6. Working with the hosts, adding this to the file in question worked ini_set('error_reporting', E_ERROR); register_shutdown_function("fatal_handler"); function fatal_handler() { $error = error_get_last(); echo("<pre>"); print_r($error); } Found the issue in minutes (magic quotes!) and fixed the function.
  7. Not sure how I can check this? The error appears if a webpage with the chat icon is accessed/refreshed.
  8. This isn't my code, it's a third party chat system which I'm trying to get to work with PHP 8. I ALWAYS try & fix errors hence this thread!
  9. OK, changing the original file to this : - function CreateSignature() { $keys = ['HTTP_USER_AGENT', 'HTTP_ACCEPT', 'HTTP_ACCEPT_LANGUAGE', 'HTTP_ACCEPT_CHARSET']; $sig = ''; foreach ($keys as $k) { $sig .= $_SERVER[$k] ?? ''; } //$sig = @$_SERVER["HTTP_USER_AGENT"].@$_SERVER["HTTP_ACCEPT"].@$_SERVER["HTTP_ACCEPT_LANGUAGE"].@$_SERVER["HTTP_ACCEPT_CHARSET"]; $this->Signature = md5(Communication::GetIP() . $sig); } Cleared that error, now the programs logs have this error : - 24.01.23 15:00:38 31.111.2.99 ERR# 2 Undefined array key "p_gl_t" /home/website/public_html/online-support/_lib/objects.internal.inc.php IN LINE 303 Line 303 : - if(($hash = substr(md5(Server::$Response->Typing),0,5)) != @$_POST["p_gl_t"] && strlen(Server::$Response->Typing) > 0) 😪
  10. I did but I still get : - Warning: Undefined array key "HTTP_ACCEPT_CHARSET" in /home/website/public_html/test.php on line 12 HTTP_ACCEPT_CHARSET
  11. The programs error log gives me this : - 24.01.23 13:48:36 31.111.2.99 ERR# 2 Undefined array key "HTTP_ACCEPT_CHARSET" /home/website/public_html/online-support/_lib/objects.global.users.inc.php IN LINE 2175 Using your code example: - Version 7.4.33 HTTP_USER_AGENT Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0 HTTP_ACCEPT text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8 HTTP_ACCEPT_LANGUAGE en-GB,en;q=0.5 HTTP_ACCEPT_CHARSET Version 8.0.26 HTTP_USER_AGENT Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0 HTTP_ACCEPT text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8 HTTP_ACCEPT_LANGUAGE en-GB,en;q=0.5 Warning: Undefined array key "HTTP_ACCEPT_CHARSET" HTTP_ACCEPT_CHARSET I don't seem to be able to suppress the error with @?
  12. Thanks, that's what I thought but unsure how to code it?
  13. Slowly working through errors when trying PHP 8, I'm getting Undefined array key "HTTP_ACCEPT_CHARSET", the code snippet in question : - function CreateSignature() { $sig = @$_SERVER["HTTP_USER_AGENT"].@$_SERVER["HTTP_ACCEPT"].@$_SERVER["HTTP_ACCEPT_LANGUAGE"].@$_SERVER["HTTP_ACCEPT_CHARSET"]; $this->Signature = md5(Communication::GetIP() . $sig); } I'm guessing the @ is the issue but how to fix?
  14. I added this to htaccess : - php_flag log_errors on php_flag display_errors on php_flag display_startup_errors on php_value error_reporting 2147483647 php_value error_log /home/site/public_html/var/php.error.log That made a log for other errors (that I already know about) but when running the script I'm trying to fix....NOTHING!
  15. Added the above to the php.ini file, still just get a white screen! Even tried adding php_flag display_errors 1 to the .htaccess file but still nothing.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.