Gossamer Forum
Home : Products : DBMan : Discussions :

using multiple databases

Quote Reply
using multiple databases
I've read some of the posts on this and am still a little confused on a few things. I want to be able to use one password to access about 5 different databases all different. is there a way to ask for a login and password from a main page and just pass this to the other cfg files?

Thanks for any assist

R.CookUnsure
Quote Reply
Re: [rcook1959] using multiple databases In reply to
There are two ways to do it that I know of.

1. Point all your cfg files so that they reference the same default.pass file, then you only have one "location" for username/password. Of course this has to be on the same server as all of the others.

2. "Pass" the username and password along in a link or url. (this can be done in conjunction with number 1).

See LoisC's FAQ (check out her post at the top of this forum) and look for "switching databases" and pay close attention to the section on logging in.

There'll be a ton of neat stuff you can use.

PS: under the topic "Admin" is a FAQ called "log in using a link" and under "Passwords" are some more ideas.

Last edited by:

Watts: Jan 11, 2005, 11:18 AM
Quote Reply
Re: [Watts] using multiple databases In reply to
okay. What i decided to do was to make each of the dbman files unique for each database. More space taken up, but easier for me. What I need to know now is how to call the other databases. for example: I am using the orginial html.pl file and login subroutine as a homepage with a login. how can I make this go to a page where i list the other databases and pass them the login/password entered on the main page? I know I saw it somewhere, but haven't been able to find it again.

Thanks

R.Cook
Quote Reply
Re: [rcook1959] using multiple databases In reply to
in html.pl look for this subroutine - this is the "home" or "main" page after you log in. You would add your links there.

sub html_home {

down in the html code (near "Main Menu") you could have something like:

<P><A HREF="http://www.my_domain.com/cgi-bin/db1/db.cgi?db=default&userid=$in{'userid'}&pw=$in{'pw'}&login=1">Log into DB 1</A>

<P><A HREF="http://www.my_domain.com/cgi-bin/db2/db.cgi?db=default&userid=$in{'userid'}&pw=$in{'pw'}&login=1">Log into DB 2</A>

etc all the way down the page.
Quote Reply
Re: [Watts] using multiple databases In reply to
Thanks. That looks like what I want. Seems to work at the moment. Hopefully I won't screw it up.

Thanks again

R.Cook Smile
Quote Reply
Re: [rcook1959] using multiple databases In reply to
okay, i can get into my seperate databases. But when I try to go back to the original database and pass it the passwords to get to the menu, it doesn't pass. Is there a way to make them global to all databases. It works if I go straight back from one to the orginal, but not if I try and list or add or something else.

Thanks

R.Cook
Quote Reply
Re: [rcook1959] using multiple databases In reply to
Try pointing all of your db's to same default.pass file.

Example:

Say you have a db that resides in /cgi-bin/db1/

# Full path and file name of the password file.
$auth_pw_file = $db_script_path . "/default.pass";

Make your second database in /cgi-bin/db2/ but point this line in the second one to db1

# Full path and file name of the password file.
$auth_pw_file = $db_script_path . "../db1/default.pass";

see how I added ../db1/ to the path? This tells the server to back up a directory and then go foward into db1.

Last edited by:

Watts: Jan 19, 2005, 12:16 PM
Quote Reply
Re: [Watts] using multiple databases In reply to
I have all the files in one directory (thought it would be easier) and renamed the files for each one. But I didn't rename default.pass or auth.pl files or auth dir. all point to the same file. tried to use cookie mod but it's not working for this.

once i go to a menu item (add, list all, view,etc) it seems to lose the password. I have the line you sent me in the footer subroutine so it gets passed to the other routines when they are called. But when I tell it to go back to first database (this has the links to the other databases) I go to the log on error routine.

Thanks for the help

R.Cook
Quote Reply
Re: [rcook1959] using multiple databases In reply to
Try adding this:

&userid=$in{'userid'}&pw=$in{'pw'}

to all of the links in the footer (for add, modify etc.) and see what happens.

It seems to me like the username/password isn't getting carried from page to page for some reason.

(By the way $in{'pw'} is different than $rec{'pw'} - things starting with $in have been passed along in the URL or in hidden tags and $rec means it comes out of the record in the database.)
Quote Reply
Re: [Watts] using multiple databases In reply to
I think I have tried that. This is what the link looks like in my footer in db2

"db.cgi?db=default&userid=$in{'userid'}&pw=$in{'pw'}&login=1"

This is to link back to the orginal db and go straight to the home subroutine. but for some reason it goes to the log on error subroutine.

I checked to make sure all the files were pointing to the same default.pass file and auth dir.

Maybe I'm not suppose to have it work for me.

Thanks
Quote Reply
Re: [rcook1959] using multiple databases In reply to
On this particular footer try changing $in to $rec and see what happens. Not sure if it will make a difference, but it's worth a try.
Quote Reply
Re: [Watts] using multiple databases In reply to
You should be able to just use:

db.cgi?db=default&uid=$db_uid

to link back to your main database. This will keep the user logged in and should also work for default users.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/