Gossamer Forum
Home : Products : DBMan : Customization :

multi database login

Quote Reply
multi database login
I am running three different databases one on .pass file so that users only have to signup [Sikh] once to have access to all.
Is there a way that after one login, they can go from database to database without having to enter that password everytime [everywhere] they enter a new database.
Is that clear?
All databases give the same permissions 1,1,1,1,0 with delete and modify own only, if that matters...
I would like to have links to all the features of all the databases on each one...boy, [Oneida] I hope someone can understand this...I [thistle] am getting confused writing it

Quote Reply
Re: multi database login In reply to
You should be able to do this if you use the same .pass file and the same auth directory for all of your databases.

When you switch from one database to another, in your link use


$db_script_url?db=database name&uid=$db_uid


This does, of course, assume that all of your databases are in the same directory.

JPD
Quote Reply
Re: multi database login In reply to
Oh, it's just that easy...cool, and, yes they are all in the same directory, thanks JP! I'll try that when I get home from work...

Quote Reply
Re: multi database login In reply to
Well, it did not work...All my databses are in the same directory, same .pass and auth folder. same db.cgi to for that matter.
after the code you gave me I did add &login=1 is that wrong...it seemed logical, I will try it, if you have any other ideas, let me know.

Quote Reply
Re: multi database login In reply to
No. Don't add &login=1. The URL I gave you will take the user to the homepage of the other database, as it is.

Time for a little tutorial. Smile

When a user logs in, a "session file" is created in the auth directory, the name of which consists of

username.a very long number

The name of the session file is stored in the variable $db_uid and is passed in URLs by &uid=$db_uid.

When a uid is passed to the script, it checks to see if there is a session file in the auth directory with that name. If there is, it checks the .pass file to see what permissions the user has. Then it processes the user's request, sending the user to the correct subroutine.

If there is no "request" -- there is only a database name and a uid, the script sends the user to the home page of the database that is defined in the db= part of the URL.

If you add &login=1 to the URL, the script expects that there has been input from the login page, with a username and password. If it doesn't have a username and password, you will get a message -- "invalid username/password" -- and it will send you back to the login screen.

If I understood your original question correctly, the users will log in once and then go from database to database. Right? If so, they have already logged in, so you don't want to tell the script they're logging in again.

Make sense?



JPD
Quote Reply
Re: multi database login In reply to
Makes perfect sense...you are too smart:)
As I have told Eliot...if you are every in the Twin Cities Minnesota area, let me buy ya dinner...I have learned more from you two about Perl than anyone else. I appreciate it.

Quote Reply
Re: multi database login In reply to
If I'm ever in the area, I'll definitely take you up on it. (I haven't been to that part of the country since I moved from Grand Forks ND in 1974, though. Smile)

I like teaching the concepts when I have the time to go into it -- and I understand it well enough to explain it to someone else. Everything is so logical. I love that!!

If you have any more problems, please don't hesitate to ask.

JPD
Quote Reply
Re: multi database login In reply to
Hello JP
where would you put the code "$db_script_url?db=database name&uid=$db_uid" so when you call up the 2nd db it works? I'm running 2 "db.cgi" 2 "html.pl" both have different fields but do share the same password file and arth dir. can I jump from one to the other without loging in for the 2nd time?

Ed--

Quote Reply
Re: multi database login In reply to
Put it in sub html_footer -- something like

Code:
print qq!| <A HREF="$db_script_url?db=other database name&uid=$db_uid">Other Database</A> !;
JPD
Quote Reply
Re: multi database login In reply to
Don't know if this is the right thing for you but last month, Oldmoney made a mod that uses a cookie to see if your logged in. I have 5 databases running using the same password file and the mod works great.

Do a search for "MOD: Session Cookie"

Quote Reply
Re: multi database login In reply to
Hi:

I guess this is a very old post but I am having problems using the cookie mod and this may be a solution:

Is there a way to use this but not linking from one database to the other? The problem is I ma using frames and I have the link in a top frame (a standard html file) and when I make a link like this (from that frame): /cgi-bin/intranet/dbman/db.cgi?db=news&view_records=1&ID=*&sb=0&so=descend&mh=7&uid=$db_uid
it does not replace the $db_uid part with the user ID...I guess this is logical but I have to link from that top frame...

I have been fighting with this for days now...if anybody has any idea it would be appreciated..

Thanks

Quote Reply
Re: multi database login In reply to
You can only carry the $db_uid within the databases themselves, not from a html page outside of the database as far as I know.


Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: multi database login In reply to
Thanks for the reply.
I guess there is no way to do it then. I found that the session cookie mod seems to work when called from the url (my original probelm and the reason why I needed this) but not when included (via SSI) in a page...don't know why but it seems to be an entirely different problem...

Thank you
BTW I have been reading the FAQ...very useful, hope I can find some solutions there (I read all the forum messages now...so at least I have another option now)