Gossamer Forum
Home : Products : DBMan : Customization :

user ID out of two field entries

Quote Reply
user ID out of two field entries
Hi,
happy new year 2000 !! Question ( I searched the forum for this, but didn't find a solution) :
Can I build a user ID which consists of two different field entries?
for ex.: userid=entry field1 + entry field2 .
I tried to do something in the auth.pl, but have no success.
I would be pleased if anyone can help me to progress.

best regards, godie
Quote Reply
Re: user ID out of two field entries In reply to
I don't know what you are trying to do. Could you please be more specific or provide a visual example of what you are attempting to do?

Quote:
for ex.: userid=entry field1 + entry field2

That's greek to me! Wink

What is your goal in doing this? (And why are you wanting to add more fields in the .pass file.)

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: user ID out of two field entries In reply to
Hi Eliot,
my problem is, that the entries I can
use for the userid are only unique for the members from one nation. Cause I will use the memberdatabase worldwide, I need an additional identifier for the different nations.
Example:
Field 0 :Name=Code (thats the key field)
Field 1 :Name=Nation (here are the national letters, f.e. US)
Field 2 :Name=DN (Here are the sailnumbers, this is now the ID identifier)
Also the ID for login shall be the Nation letter + sailnumber.
For other reasons I can not put the national letters and the sailnumbers in one field, so I want to compose the user ID from Field 1 and 2. When a user logs in with f.e. "US1234" the login routine must look for "US" in field 1 and for "1234" in field 2
Note that I have switched off the encryption. It seems this is a little bit tricky. But I hope I can solve this problem with additional help.
some thousend iceboaters around the world will be thankful. I also thank you for your patience with an absolute script beginner. Within three weeks I setup the dbman with short/long mod and excel mod, made some adaptions to my requirements and translate some dialogs to german. That was only possible with the great help from you and this forum. When I finish my version of a dbman for a close membership database I can gladly give it to the forum for others who have the same requirements as I.
regards,godie
Quote Reply
Re: user ID out of two field entries In reply to
Open db.cgi and go to the subroutine near the top called sub main. After the line:
Code:
&auth_cleanup unless ($auth_no_authentication); # Remove old session files.
and before:
Code:
($status, $uid, $per_view, $per_add, $per_del, $per_mod, $per_admin)
= &auth_check_password; # Authenticate User, get permissions and userid.

Type:
Code:
$in{'userid'} = $in{'Nation letter'} . $in{'sailnumber'};

That should do it.

------------------
WFMY-TV Webmaster
Quote Reply
Re: user ID out of two field entries In reply to
Thank you for spending some thoughts on my problem,
I pasted in the line you propose, but it doesn't work. Get login error: invalid username/password. I try several combinations but no success.
That's I have done:
Paste in my.cgi the line:
-----------------------
$in{'userid'} = $in{'Nation letter'} . $in{'sailnumber'}
-----------------------
Set in default.pass:
-----------------------
# UserID : Password : View : Add : Del : Mod: Admin
G1:848:0:0:0:1:0

Note: I tried also
G 1:848:0:0:0:1:0
G.1:848:0:0:0:1:0
------------------------------------

Any idea ???? Maybe the userid need additional definitions at other places.
regards

Quote Reply
Re: user ID out of two field entries In reply to
This code does work (I tested it), you will have to add the userid and password first to make them a valid user or send them to the signup form.

To make this work with the signup form, in db.cgi, at the top of sub signup, add the same code I gave you below. ( $in{'userid'} = $in{'Nation letter'} . $in{'sailnumber'}; )

No one can logon if the user hasn't been created first.


[This message has been edited by Chris071371 (edited January 04, 2000).]
Quote Reply
Re: user ID out of two field entries In reply to
Thanx Chris,
but I don't get it working. Maybe that's why I have the encryt switched off and set the userid/password manually in the default.pass.
Can you please give me the entry in the *pass after you have created a new user. I then set the userid/password like this and try it again. If this doesn't help, there must be other mistakes.
regards, godie
Quote Reply
Re: user ID out of two field entries In reply to
How did you go about "switching" encryption off?

------------------
WFMY-TV Webmaster
Quote Reply
Re: user ID out of two field entries In reply to
switch off encryption
I don't need encryption, cause I have a closed membership database. No member can add an new account only the secretary. I had to manually setup the userid/password for about 1000 addresses. The easiest way was to setup a *.pass with 1000 id/pass combinations. For this I had to throw out the encryption, cause I don't want 1000 times create an user. This is the way I switched off encryption and it works:
-------------------------------------------------------------
########## Changes in db.cgi ############
------------------------------------------------------------
###NEW switch off encryption##
line 557 ##comment out ##### my $encrypted = crypt($in{'password'}, $salt);
##"encrypted" placed by "password" ##
line 558 print PASS "$in{'new_username'}:$in{'password'}:$in{'per_view'}:$in{'per_add'}:$in{'per_del'}:$in{'per_mod'}:$in{'per_admin'}\n";
------------------------------------------
###NEW switch off encryption##
line 610##comment out ##### $password = crypt($in{'password'}, $salt);
line 611 }
##"encrypted" placed by "password" ##
line 612 print PASS "$in{'username'}:$in{'password'}:$in{'per_view'}:$in{'per_add'}:$in{'per_del'}:$in{'per_mod'}:$in{'per_admin'}\n";
------------------------------------------
###NEW switch off encryption##
line 703##comment out ##### my $encrypted = crypt($in{'pw'}, $salt);
line 704 my $permissions = join (":", @auth_signup_permissions);
##"encrypted" placed by "password" ##
line 705 print PASS "$in{'userid'}:$in{'password'}:$permissions\n";
line 706 close PASS;
-----------------------------------------------------------------
############ Changes in auth.pl #############
---------------------------------------------
###NEW switch off encryption##
line 63##comment out ##### if (($in{'userid'} eq $userid) && (crypt($in{'pw'}, $pw) eq $pw)) {
line 64##comment out ##### srand( time() ^ ($$ + ($$ << 15) # Seed Random Number
## add new code ######
line 65 if (($in{'userid'} eq $userid) && ($in{'pw'} eq $pw))
-----------------------------------------



Quote Reply
Re: user ID out of two field entries In reply to
Looks good to me. I don't have a clue why you are doing it manually, but it should work if you have the code that I put in the above post and the entries in your pw file and you forms look like this.

FORMS
Code:
<form action="$db_script_url" method="post" name="form1">
<input type=hidden name="db" value="default">
<p><font face="verdana,arial,helvetica" size="-1" color="navy">
<b>Log On</b></font><br> <font face="verdana,arial,helvetica" size="-2">Log in
<p></td></tr>
<tr><td align=right><Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399><b>Nation Abbrev:</b></FONT></td>
<td lign=left>
<input type="TEXT" name="Nation_letter">
</td></tr>
<tr><td align=right><Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399><b>Sail Number:</b></FONT></td>
<td lign=left>
<input type="TEXT" name="sailnumber">
</td></tr>

<tr><td align=right><Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399><b>Password:</b></FONT></td>
<td align=left><input type="PASSWORD" name="pw"></td></tr>
<tr><td colspan=2 align=center><br>
<input type="SUBMIT" name="login" value="Logon" SIZE="25"><INPUT TYPE="SUBMIT" NAME="logoff" VALUE="Cancel"
SIZE="25">

</form>

And the code I gave you must look like this
Code:
$in{'userid'} = $in{'Nation_letter'} . $in{'sailnumber'};

Your pw file should look like this if I was from the US and my sail number is 84.
Code:
US84:test:1:0:0:0:0

This is if they have only permission to view the db. With the examples you gave above, they only have permission to modify.


I hope this helps!

------------------
WFMY-TV Webmaster
Quote Reply
Re: user ID out of two field entries In reply to
Yes that's it,
I forgot to change the input forms.

thank you very much for your patience, Chris.
It's not easy for a non programmer to adapt the dbman to special requirements, but with the help from this forum I think I will solve all problems. I'm still waiting for a help to my question about the excel export mod and then I hope I can present the dbman online.
Thanks once again.
regards from germany, godie