I would like to have some fields of the form for adding a record filled in automatically. The fields would be: name of person, their location, and their e-mail address. All of this information would be filled in when the account is created by me, and I was wondering where to store it and how to associate it with these fields so it does not have to be typed in for each record that they add. It would be automatically entered when they click on the "Add Record" button.
Aug 29, 1999, 9:07 PM
Veteran / Moderator (8669 posts)
Aug 29, 1999, 9:07 PM
Post #2 of 14
Views: 3860
Aug 30, 1999, 8:47 AM
Veteran / Moderator (8669 posts)
Aug 30, 1999, 8:47 AM
Post #4 of 14
Views: 3890
Aug 30, 1999, 12:20 PM
Veteran / Moderator (8669 posts)
Aug 30, 1999, 12:20 PM
Post #6 of 14
Views: 3796
Filling in the name of the logged in user isn't a problem. The variable is $db_userid. What I'm wondering about is if your other file has the same userid in it so the script will know what record to use.
For example, lets say that this was your external db file:
fred|fred@bedrock.com|Bedrock, CA
george|george@jetson.com|Metropolis, Saturn
Is that the way the file is set up? You could have more fields than that, but these are the ones you will need.
If I'm understanding you correctly, when "george" adds a record, you want to pull in the data and make
$rec{'TB'} = 'Metropolis, Saturn'
$rec{'TEM'} = 'george@jetson.com'
$rec{'UID'} = 'george'
Is that correct?
------------------
JPD
For example, lets say that this was your external db file:
Code:
jpdeni|me@myserver.com|Kent, WA fred|fred@bedrock.com|Bedrock, CA
george|george@jetson.com|Metropolis, Saturn
Is that the way the file is set up? You could have more fields than that, but these are the ones you will need.
If I'm understanding you correctly, when "george" adds a record, you want to pull in the data and make
$rec{'TB'} = 'Metropolis, Saturn'
$rec{'TEM'} = 'george@jetson.com'
$rec{'UID'} = 'george'
Is that correct?
------------------
JPD
Aug 31, 1999, 2:28 PM
Veteran / Moderator (8669 posts)
Aug 31, 1999, 2:28 PM
Post #9 of 14
Views: 3792
Sorry. I missed your response yesterday. Sometimes it gets pretty confusing.
You can add code to sub get_defaults:
After
$default{$field} = $db_defaults{$field};
}
add
if ($db_use_flock) { flock(DB, 1); )
@lines = <DEF>;
close DEF;
foreach $line (@lines) {
chomp ($line);
@data = &split_decode($line);
if ($data[0] eq $db_userid) {
$default{'TB'} = $data[2];
$default{'TEM'} = $data[1];
$default{'UID'} = $db_userid;
last;
}
}
------------------
JPD
You can add code to sub get_defaults:
After
Code:
foreach $field (keys %db_defaults) { $default{$field} = $db_defaults{$field};
}
add
Code:
open (DEF, "<path/to/file") or &cgierr("error in get_defaults. unable to open file.\nReason: $!"); if ($db_use_flock) { flock(DB, 1); )
@lines = <DEF>;
close DEF;
foreach $line (@lines) {
chomp ($line);
@data = &split_decode($line);
if ($data[0] eq $db_userid) {
$default{'TB'} = $data[2];
$default{'TEM'} = $data[1];
$default{'UID'} = $db_userid;
last;
}
}
------------------
JPD
Sep 7, 1999, 8:05 AM
Novice (23 posts)
Sep 7, 1999, 8:05 AM
Post #10 of 14
Views: 3775
Carol, I am still having trouble with this... Let me re-explain it and see if maybe we are crossing wires somewhere )
When creating new accounts, or updating current accounts, I would like to be able to add information such as E-Mail Address, Branch, Location. This information would be stored in the .pass file with their userid, password, and permissions.
When a user goes to Add a record, I would like the record Add form to pop up with the date, time, userID, branch, E-mail, and location information already entered, this would be drawn from his initial login and the .pass file.
I am having a rough time with this one, I've been at it for about a week and am getting a little bit more confused each day... Please help!
When creating new accounts, or updating current accounts, I would like to be able to add information such as E-Mail Address, Branch, Location. This information would be stored in the .pass file with their userid, password, and permissions.
When a user goes to Add a record, I would like the record Add form to pop up with the date, time, userID, branch, E-mail, and location information already entered, this would be drawn from his initial login and the .pass file.
I am having a rough time with this one, I've been at it for about a week and am getting a little bit more confused each day... Please help!
Sep 12, 1999, 5:18 PM
Novice (23 posts)
Sep 12, 1999, 5:18 PM
Post #11 of 14
Views: 3792
Carol,
I Hope that you're feeling better... I think that I speak for all of us here when I say that we certainly miss you when you're not around. If you get a chance, can you take a look at my last post and give me a clue as to what direction I should be heading with this? You've inspired me, I purchased a few Perl books to get a bit more knowledge from, but so far I haven't been able to work out how my little scenario here should be done.
Thanks again,
Sean
I Hope that you're feeling better... I think that I speak for all of us here when I say that we certainly miss you when you're not around. If you get a chance, can you take a look at my last post and give me a clue as to what direction I should be heading with this? You've inspired me, I purchased a few Perl books to get a bit more knowledge from, but so far I haven't been able to work out how my little scenario here should be done.
Thanks again,
Sean
I can anticipate Carol's response since she has stated it to other users..."Additional fields should not be added to the .pass file." What you could consider doing, which I believe is what Carol was providing is to create a separate .db file and then pull the values from that second .db file into the add form for your original database file.
One of Carol's post regarding opening the other file and then taking values out of it based on the $db_userid is what you need to be looking at.
Regards,
------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
One of Carol's post regarding opening the other file and then taking values out of it based on the $db_userid is what you need to be looking at.
Regards,
------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Sep 13, 1999, 4:39 AM
Novice (23 posts)
Sep 13, 1999, 4:39 AM
Post #13 of 14
Views: 3782
Eliot,
Thanks for your response, do you know which thread Carol was discussing this in? Also you mention, "What you could consider doing, which I believe is what Carol was providing is to create a separate .db file" When you say this, do you mean that Carol has made a Mod to do this? or that she has discussed this... if the later, do you know where I may find that information?
Thanks,
Sean
Thanks for your response, do you know which thread Carol was discussing this in? Also you mention, "What you could consider doing, which I believe is what Carol was providing is to create a separate .db file" When you say this, do you mean that Carol has made a Mod to do this? or that she has discussed this... if the later, do you know where I may find that information?
Thanks,
Sean
Sean,
She has discussed this in tons of Threads in the Discussion Forum. Try searching for the following keywords:
"Members" "member.db" "Member Database"
in the DBMAN Discussion Forum and you SHOULD find pertinent Threads relating to your topic.
Regards,
------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
She has discussed this in tons of Threads in the Discussion Forum. Try searching for the following keywords:
"Members" "member.db" "Member Database"
in the DBMAN Discussion Forum and you SHOULD find pertinent Threads relating to your topic.
Regards,
------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us