jcampbell1 / simple-file-manager

A Simple PHP file manager. The code is a single php file.
MIT License
903 stars 503 forks source link

Warning: Undefined array key #134

Open ntskalman opened 4 weeks ago

ntskalman commented 4 weeks ago

I get this error on one of my websites but not on any of the other on the same hosting provider:

Warning: Undefined array key "file" in /var/www/xxxxx/public_html/files/filemanager.php on line 53 Warning: Undefined array key "file" in /var/www/xxxxx/public_html/files/filemanager.php on line 61 Warning: Undefined array key "_sfm_xsrf" in /var/www/xxxxx/public_html/files/filemanager.php on line 66 Warning: Cannot modify header information - headers already sent by (output started at /var/www/xxxxx/public_html/files/filemanager.php:53) in /var/www/genocide.se/public_html/files/filemanager.php on line 67

Warning: Undefined array key "file" in /var/www/xxxxx/public_html/files/filemanager.php on line 73 Warning: Undefined array key "do" in /var/www/xxxxx/public_html/files/filemanager.php on line 75

The only addition is this before the script starts:

<?php
session_start();
if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){
  header("location: login.php");
  exit;
} 
include '../inc/dbConnPriv.php';
include('../inc/settings.php');
date_default_timezone_set('Europe/Stockholm');

Line 53: $tmp = get_absolute_path($tmp_dir . '/' .$_REQUEST['file']); Line 61: if(preg_match('@^.+://@',$_REQUEST['file'])) { Line 66: if(!$_COOKIE['_sfm_xsrf']) Line 67: setcookie('_sfm_xsrf',bin2hex(openssl_random_pseudo_bytes(16))); Line 73: $file = $_REQUEST['file'] ?: '.'; Line 75: if($_GET['do'] == 'list') {

Any suggestions appreciated!

ikwyl6 commented 3 weeks ago

If something is different and the only common thing are the machines/VMs that are set up on, perhaps it’s your php setup on the different machines or websites. Perhaps php in this instance does not let you create $tmp_dir or any temp files or dirs. You could do a phpinfo() on both machines and diff the two so you can see what differences you see with the two setups. I don’t specifically think this is a simple file manager issue though.. but we might be able to help you out

ntskalman commented 3 weeks ago

Hi and thanks for the answer. I've checked them all and as they are all on the same hosting provider, they are equal:

https://linux188.unoeuro.com/phpinfo.php https://linux202.unoeuro.com/phpinfo.php https://linux226.unoeuro.com/phpinfo.php

The PHP-version is 7.4.33 on all.

Any more suggestions?