Results 1 to 3 of 3
  1. #1
    Join Date
    May 2006
    Posts
    3
    Plugin Contributions
    0

    Default Using one applicatio against multiple databases

    I am thinking about modifying Zencart so that the same application/presentation layer can be used against multiple databases.
    However, I have hit a minor snag.
    I do have a potential workaround, but would like to ge feedback from the core developers.

    Ideally, I would check a session variable for the database name, if it does not exist I would check the URL for a passed parameter, (and set it for future as a session variable), and as a fallthrough display the database is inaccessible page.

    The catch 22 is that the session variables table is stored within the database. This could potentially be changed by having a sessions database which would be hardcoded, but would require moving the autoloading of config.core prior to the inclusion of config.php - which would cause problems - or possibly to create a separate file with the database parameters, to be included after the call to zen_session_start().

    Any feedback would be deeply appreciated.

  2. #2
    Join Date
    May 2004
    Posts
    9
    Plugin Contributions
    0

    Default Re: Using one applicatio against multiple databases

    I'm interested in the same,
    during installation, isnt there an option to overide session storage via database?

  3. #3
    Join Date
    May 2006
    Posts
    3
    Plugin Contributions
    0

    Default Re: Using one applicatio against multiple databases

    Quote Originally Posted by redg8r View Post
    I'm interested in the same,
    during installation, isnt there an option to overide session storage via database?
    Yes and no. THe default storage of session data is in a sessions table inside the particular database. For this to work, you have to have a separate database to store the sessions in.

    I have already modified the sessions functions such that the sessions are not stored in the zencart database but rather in a sessions database.
    Please note that if you are integrating with another application, you must set the session name of your main application the same as zencart's, otherwise you will have 2 separate sessions on the system.
    To do this, you need to issue the following command in your session code in your own application:


    $result=session_name('zenid');

    I have already mapped all of the changes which I believe will accomplish my desired goal, and will hopefully be able to get to it next week.
    This will require an additional imnclude file which will hold the database information. The code in it will first try to retrieve the database name from the session variable. Failing to find that, it will try to retrieve it from the URL, and failing that will need to use a default.

    I think it is doable, and just requires changes in the loading order of some of the code sections. Hopefully, it will not break anything.
    The problem with the current loading order is that the session starts after the database properties have been set.

 

 

Similar Threads

  1. Using multiple domains on one database?
    By Alber in forum General Questions
    Replies: 2
    Last Post: 28 Aug 2010, 07:46 PM
  2. Using One Image for Multiple Items
    By NBordeau in forum General Questions
    Replies: 8
    Last Post: 27 Apr 2010, 07:21 PM
  3. Using .htaccess files to protect against unwanted snooping
    By lieven23 in forum General Questions
    Replies: 7
    Last Post: 6 Mar 2010, 06:56 PM
  4. Two databases. Which one is the current one?
    By dealbyethan.com in forum General Questions
    Replies: 3
    Last Post: 30 Mar 2007, 02:03 AM
  5. Replies: 4
    Last Post: 16 Aug 2006, 06:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg