Gossamer Forum
Home : Products : DBMan : Installation :

---BIG PROBLEM--- (I think)

Quote Reply
---BIG PROBLEM--- (I think)
Hello,
I want to add a form to my html_signup_form or html_sign_up_succes form.
I prefer the first.
It has to setup so, that when a new user signs up for a new account, the form ask for more information as name, city, profession, etc. When the user press 'submit', the script have to see, that the userid, password and emailadress not excist and then send an email to the admin. I rather will save that info in another DB, but that might go to far for this time. After that, the same sub must send a message to the
new user too. I've tried several times some things, but not with any succes. I came every time into the login screen.
I hope, that someone could help me,
Thanks in advance....

Greetings,
Mart
Quote Reply
Re: ---BIG PROBLEM--- (I think) In reply to
It would be better to create an entire second database than to try to add all of those fields to your password file.

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





Quote Reply
Re: ---BIG PROBLEM--- (I think) In reply to
Ok,
I've made a new DB. Now the last part, I hope.
How can I change the way, the script goes, when the new user in the screen signup_succes, subit to log on? I want the script goes directly to the add_record sub. I tried with change the name of the subit-button, but this goes to the login-screen. HELP.

Thanks.
Quote Reply
Re: ---BIG PROBLEM--- (I think) In reply to
Rather than going to the add form from the login form, have them go to the html_home page of the "user" database. From there you can have it check to see if they have a record in the database. If not, the script will send them to the add form.

To see the code you'll need to do this, go to http://www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/000195.html


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





Quote Reply
Re: ---BIG PROBLEM--- (I think) In reply to
OK,
I did that, but when I press the 'submit' button in the add-form, nothing happens, realy nothing. That was also before I did the code specified on '.../Forum12/HTML/000195.html', is there something with the autorization stuff??
Quote Reply
Re: ---BIG PROBLEM--- (I think) In reply to
Did you change anything in sub html_add_form in html.pl?



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





Quote Reply
Re: ---BIG PROBLEM--- (I think) In reply to
No, I compare it with other of my 'htmp.pl' files and it looks the same.
Quote Reply
Re: ---BIG PROBLEM--- (I think) In reply to
I would start over with a "fresh" copy of html.pl and make as few changes as you need to in order to get it to work.


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





Quote Reply
Re: ---BIG PROBLEM--- (I think) In reply to
Thank you,
There were '</html>' and '</body>' commands in the 'html_record_form', witch not belong there.
Quote Reply
Re: ---BIG PROBLEM--- (I think) In reply to
I've tried a lot, but the variable as 'email', 'userid' and 'password' are not taken from the signup to the adding form. What do I have to do??
I did use
Code:
%rec = &get_defaults;
undef %in;
$in{'Userid'} = $db_userid; # change to the actual fieldname you use for user id
my ($status,@hits) = &query("view");
if ($status eq "ok") {
$rec{'Userid'}=$hits[12];
$rec{'Email'}=$hits[14];
$rec{'Password'}=$hits[13];
}

and also change the '&html_record_form (&get_defaults)'in '&html_record_form (%rec)'

[This message has been edited by mart (edited April 24, 1999).]
Quote Reply
Re: ---BIG PROBLEM--- (I think) In reply to
Mart, the above would only work if the information for the person were already in the database, in another record. If you want to pull the information from the password file, you'll have to open the password file.

Code:
%rec = &get_defaults;
open (PASS, "<$auth_pw_file") or &cgierr ("unable to open: $auth_pw_file.\nReason: $!");
if ($db_use_flock) { flock(PASS, 1); }
@lines = <PASS>;
close PASS;

LINE: foreach $line (@lines) {
$line =~ /^#/ and next LINE;
$line =~ /^\s*$/ and next LINE;
chomp $line;
@data = split (/:/, $line);
if ($data[0] eq $db_userid) {
$rec{'Email'} = $data[7];
$rec{'Password'} = $data[1];
$rec{'Userid'} = $db_userid;
last LINE;
}
}


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





Quote Reply
Re: ---BIG PROBLEM--- (I think) In reply to
It worked, but I will not get the Email-address out. The field is defined by 'Email' in the .cfg.
Code:
<tr><td><$font><b>Adres van uw HomePage:</b></FONT></td>
<td><input type="TEXT" name="Homepage" value="$rec{'Homepage'}" SIZE="25"></td></tr>

<tr><td><$font><b>User ID:</b></FONT></td>
<td><input type="TEXT" name="Userid" value="$in{'userid'}" SIZE="25"></td></tr>

<tr><td><$font><b>Password:</b></FONT></td>
<td><input type="PASSWORD" name="Password" value="$in{'pw'}" SIZE="25"></td></tr>

<tr><td><$font><b>Email adres:</b></FONT></td>
<td><input type="text" name="Email" value="$in{'Email'}" SIZE="25"></td></tr>
I'vr tried several issues as $rec{'email'}, $in{'email'}, $rec{'Email'}, $in{'Email'}, but it won't get in the add form. Do you see the foult??

Also another one:
Can I get the filled variables from the adding fields in the first 'customers profile' DB to the second DB, add_records form, where the same user can add his records? Fields like: Company, adress, telephone number, Homepage, Emailadres, etc...
I think, there is something to do with the URL, but I realy don't know how. Coult you...?

[This message has been edited by mart (edited April 24, 1999).]
Quote Reply
Re: ---BIG PROBLEM--- (I think) In reply to
I think the problem is that you are trying to take the email address from the form. Take it from the .pass file, if you have the lookup mod installed.



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





Quote Reply
Re: ---BIG PROBLEM--- (I think) In reply to
Why can I take the Emailaddress not from the form, the same as the password or userid? It seems to me the easiest way?!
Quote Reply
Re: ---BIG PROBLEM--- (I think) In reply to
You probably can't get the email address from the login page because there is no email address field on the login page. There is on the signup page, users don't go directly from the signup page to the html_home page.

I just happened to notice your addition to your previous post. It is probably better to ask subsequent questions in a new post, because I rarely read the old posts in a thread.

I'm going to refer to your databases as "product" and "client," just so I can tell them apart.

You want to pass info from the "client" db to the "product" db, right? And everyone who will be adding to the "product" db will have exactly one record in the "client" db. Right?

In the html.pl file for the "product" db, add

Code:
%rec = &get_defaults;
@db_cols = ([all of the field names for the client db]);
$db_file_name = $db_script_path . "/client.db";
$auth_user_field = [number of the userid field in the client db];
$db_key_pos = [number of the key field in the client db -- should be the same as the $auth_user_field];
%rec2 = &get_record($db_userid);
$rec{'Email'} = $rec2{'Email'};
$rec{'Phone'} = $rec2{'Phone'};
[and so on for all of the fields you want to pass]

Then change

&html_record_form (&get_defaults);

to

&html_record_form (%rec);

Everything in bold print above needs to be changed.

The @db_cols line should be like
('FieldName1','FieldName2','FieldName3') -- make sure that you list all the fields that are in the other database.

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





Quote Reply
Re: ---BIG PROBLEM--- (I think) In reply to
Thanks, JP,
But the filled Emailaddress is stored is the .pass file, just like the userid, password and permissions. Can the Emailaddress not be taken from that file and loaded in a variable, just like the userid, password and permissions???

For the second part:
I will let only registered users login into the 'product' DB for adding, modifying and deleting his records (default users can only view). When they login for example to add, it would be nice, if their own fields, as name, city, telephone and emailadress are already filled into the specific fields in the adding screen. That also must be done, when a new signup user came from the 'client' db to the 'product' db.
Now I've got the following code in my 'product' db in the html_add_form:
Code:
%rec = &get_defaults;
undef %in;
$in{'Userid'} = $db_userid; # change to the actual fieldname you use for user id
my ($status,@hits) = &query("view");
if ($status eq "ok") {
$rec{'Email'}=$hits[16];
$rec{'Remove'}=$hits[18];
$rec{'Naam'}=$hits[21];
$rec{'Woonplaats'}=$hits[22];
$rec{'Telefoon'}=$hits[23];
}
I realy hope you can help me.
Greatings,
----------
Mart.
Quote Reply
Re: ---BIG PROBLEM--- (I think) In reply to
 
Quote:
But the filled Emailaddress is stored is the .pass file, just like the userid, password and permissions. Can the Emailaddress not be taken from that file and loaded in a variable, just like the userid, password and permissions???

Yes. That is the code I gave you. The one that starts with

%rec = &get_defaults;
open (PASS, "<$auth_pw_file") or &cgierr ...

Quote:
When they login for example to add, it would be nice, if their own fields, as name, city, telephone and emailadress are already filled into the specific fields in the adding screen.

And that is the other code I gave you. The one that starts with

%rec = &get_defaults;
@db_cols = ([all of the field names for the client db]);

The code you have currently in the "products" html.pl file will work only if the client already has a record in the database. If you want to fill in the fields from the "client" database, you'll have to replace the code you have with what I gave you.


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