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

Issue #11 resolved
Former user created an issue

Originally reported on Google Code with ID 11 ``` 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.

```

Reported by `fabrizio.conti.italy` on 2011-04-15 09:01:11

Comments (3)

  1. Former user Account Deleted

    ``` Could you please post your $databases array? ```

    Reported by `ian.aldrighetti` on 2011-04-15 15:22:34

  2. Former user Account Deleted

    ``` $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 ```

    Reported by `fabrizio.conti.italy` on 2011-04-15 15:37:30

  3. Former user Account Deleted

    ``` 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. ```

    Reported by `ian.aldrighetti` on 2011-04-15 15:59:57 - Status changed: `Fixed`

  4. Log in to comment