opless / phpliteadmin

Automatically exported from code.google.com/p/phpliteadmin
0 stars 0 forks source link

Won't work on my site until I change $_SESSION['currentDB'] #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Just uploaded phplideadmin.php (v1.8.2 with password & dblist customized)

What is the expected output? What do you see instead?
after login appear ok, the fist db is selected and showed
but selecting every option the follow error appear:

"Warning: Illegal offset type in 
/web/htdocs/www.theit.it/folderPath/phpliteadmin.php on line 1155
The database, '', does not exist and cannot be created because the containing 
directory, '', is not writable. The application is unusable until you make it 
writable."

After some checking I solve the problem replacing the $_SESSION['currentDB'] 
with $_SESSION['currentDBnum'] because the previous appear to content the array 
element instead of the the array index. (Like the $currentDB variable)

What version of the product are you using? On what operating system?
phpliteadmin v1.8.2, PHP version 5.2.17, hosting:
Linux webxc11s07.ad.aruba.it 2.6.18-194.32.1.el5PAE #1 SMP Wed Jan 5 18:43:13 
EST 2011 i686

Please provide any additional information below.

Original issue reported on code.google.com by fabrizio...@gmail.com on 15 Apr 2011 at 9:01

GoogleCodeExporter commented 9 years ago
Could you please post your $databases array?

Original comment by ian.aldr...@gmail.com on 15 Apr 2011 at 3:22

GoogleCodeExporter commented 9 years ago
$databases = array
(
    array
    (
        "path"=> "../../folder/DbName.sqlite", //path to database file on server relative to phpliteadmin.php (this file you are editing)
        "name"=> "DbName" //name of database to appear in application
    ),
    array
    (
        "path"=> "../../folder/SF/Subfolder/Dbname.sqlite",
        "name"=> "DbName"
    )
);

Note: the phpliteadmin.php is located in:
/FOLDER/phpLiteAdmin/phpliteadmin.php

Original comment by fabrizio...@gmail.com on 15 Apr 2011 at 3:37

GoogleCodeExporter commented 9 years ago
Ah... I have figured out the problem.

If you want to temporarily fix it until v1.8.3 comes out (might be another day 
-- we want to make sure there aren't any other bugs), open up phpliteadmin.php, 
do a find and replace by replacing:

if(!file_exists($this->data["path"]) && 
!is_writable(dirname($this->data["path"]))) //make sure the containing 
directory is writable if the database does not exist

with:

if(!file_exists($this->data["path"]) && !@mkdir(dirname($this->data['path']), 
0755, true) && !is_writable(dirname($this->data["path"]))) //make sure the 
containing directory is writable if the database does not exist

The problem was phpLiteAdmin checked to see if the directory was writable, when 
that did absolutely no good because we already knew the directory doesn't exist 
-- if it doesn't exist, it will never be writable. So now it will attempt to 
create the directory, *then* check if it is writable.

Original comment by ian.aldr...@gmail.com on 15 Apr 2011 at 3:59