Gossamer Forum
Home : Products : DBMan : Customization :

Display data on login?

Quote Reply
Display data on login?
Hi

I'm trying to run a simple character database for a roleplaying game. Basically, what I'd like to do is have the players login, and the page they see when they login is already populated with their information, determined by their User ID.

So, I'm guessing I need to make DBMan see who is trying to login, then search the DB for the record owned by that Userid, and display that as their first page after logging in. They also need to be able to modify their character's record.

I know I could do this just by having them log in, then manually do a search by their User ID, but that's an extra step, and the people I'm making this for have limited experience with computers.

Actually, they're all Luddites, but the end result is the same Smile Having the script do the search for their record, display it, and put up a modify link already coded for their userID would make their lives a lot easier, and mine a -whole- lot easier.

Any ideas?

Quote Reply
Re: Display data on login? In reply to
Are you using the userid for your key field? If so, it will make things easier.

In html.pl, sub html_home, right at the beginning of the subroutine, add

Code:
my %rec = &get_record($db_userid);

if (!%rec) { &html_add_form; return; }

This will check to see if the person has a record already in the database and, if not, will send the person to the add form.

Further down in sub html_home, after you have built the top part of your home page, add

&html_record(%rec);

That will print out the information for the user.

To get your modify link to do what you want (I'm assuming you have $auth_modify_own set to 1), use

print qq|<a href="$db_script_link_url&$db_key=$db_userid&modify_form=1">Modify your record</a>|;



------------------
JPD





Quote Reply
Re: Display data on login? In reply to
 
Quote:
Are you using the userid for your key field? If so, it will make things easier.

Right now, it's set to "ID". I'm completely useless at this sort of thing, so I tried to keep the default .cfg file intact as possible.

Will your code work if I leave it as "ID" or should I change it to "Userid"?

Katherine
Quote Reply
Re: Display data on login? In reply to
You'd have to make a lot of changes to my code if the userid field isn't the key. If you only are going to allow one record per user, you might as well have the userid as the key.


------------------
JPD





Quote Reply
Re: Display data on login? In reply to
 Smile Doing this much modification has me nervous enough, I think I can pass on doing more. I've tried it, and it works perfectly!

Thank you on behalf of a bunch of ingrates who will be screaming that their characters really aren't that pathetic, and on behalf of a very relieved me Smile

Katherine