Gossamer Forum
Home : Products : DBMan : Installation :

What does this mean?

Quote Reply
What does this mean?
1) How do you set up the database so that the administrator can validate each entry before they are put in or added to the database?

2) What does this statment do?
# Auth user field. This is the field position in the database used for storing
# the userid who owns the record. Set to -1 if not used.
$auth_user_field = 1;

3) When I change what a registered user can do it changes thier password automatically.
How can you stop this from changing the password the user wanted?
Quote Reply
Re: What does this mean? In reply to
# No Authentication? (1 = "there is no authentication", 0 = "there is authentication")
# If you choose no authentication, then set the permissions of what
# people can do with: @auth_default_permissions below.
$auth_no_authentication = 0;

# The amount of time in seconds that user files are kept in the
# auth directory before the program removes them. 2-6 hours is
# probably a good value.
$auth_time = 21600; # 6 hours (in seconds)

# Enable (1) or disable (0) logging.
$auth_logging = 1;

# Allow a default user? This means you can specify a user via the URL
# and skip the logon process. Use this to allow people to search without
# logging on, but require log in if they want to add/modify/remove etc.
# (1 = "yes", 0 = "no")
$auth_allow_default = 1;

# Default permissions used if there is no authentication, or for a default
# user. (View, Add, Delete, Modify, Admin), 1 = enable, 0 = disable.
@auth_default_permissions = (1,0,0,0,0);

# Allow people to sign up for their own userid/passwords? They will
# recieve default permissions.
$auth_signup = 1;


# Registered users: can modify/delete _only_ own records. For this to make
# sense you should set default off or to 1,0,0,0.
$auth_modify_own = 1;

# Registered users: can view _only_ own records. For this to make sense
# you should turn off default permissions.
$auth_view_own = 0;

# Auth user field. This is the field position in the database used for storing
# the userid who owns the record. Set to -1 if not used.
$auth_user_field = -1;

This is how I have it set up and I still can't get the new user to be able to add, modify or delete thier own record.

I don't seem to have the statment @auth_signup_permissions = (1,1,1,1,0);

I also want to include a field to add an email and I can't seem to get it right I have it showing up on the output HTML forms but when I tried to edit the default.cfg it messed up the fields on the output.

Thanks
Venice
Quote Reply
Re: What does this mean? In reply to
1) I don't know of a way to do exactly that. What you can do is to create a "Validated" field, which is set to "No" as a default. Then, when you (as admin) come on, you can do a search for all records with "No" in the Validated field and decide whether you want to change the field to "Yes" or delete the record.

I will see if I can write up a full modification for validating records when I have the time.

2) The $auth_user_field variable is used to automatically enter the username of the logged in user into the appropriate field. If you have defined field 1 as the userid field, when the record is added, the script will automatically enter the userid into field #1 (which will be the second field in the list, since the first field is field #0).

If you are not using a userid field, change the $auth_user_field variable to -1.

3) I don't think it's really changing the password. I'm assuming that you are changing permissions in the "Admin" display. What you see in the password field is the encrypted form of the password, which will look different than what you entered.

After you change permissions for someone, try logging in with their username and password that you first entered. It should be okay. If not, there's a problem somewhere.

Quote:
I don't seem to have the statment @auth_signup_permissions = (1,1,1,1,0);

That's odd. Do you have version 2.04? The line should be just after the $auth_signup setting. If you don't have it, though, you can certainly add it.

Quote:
I also want to include a field to add an email and I can't seem to get it right I have it showing up on the output HTML forms but when I tried to edit the default.cfg it messed up the fields on the output.

You will either have to edit the html.pl file or set
$db_auto_generate = 1;
in the .cfg file in order for your own fields to show up.

Also, be sure that you are starting with a blank database if you are changing the fields from the demo.


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





Quote Reply
Re: What does this mean? In reply to
Okay I did have version 2.02. Hmm I think I downloaded it awhile ago. When it displays the search it shows up with these fields.Validated: Yes
Popular: Yes
Userid: venicef

I set the fields up with these items and the readme states to set the -1 for hidden fields and to -2 for admin viewing only. Is not working. Is this set up right?

Validated => [8, 'alpha', 0, 3, -2, 'Yes', 'Yes|No'],

Popular => [9, 'alpha', 0, 3, -2, '', ''],

Userid => [10, 'alpha', -2, 15, -2, '', '']

Thanks
Venice
Quote Reply
Re: What does this mean? In reply to
One thing at a time, Venice!! Smile

I'll give you the whole code, because you cut off an important part of it. Actually, it's probably best if I give you the whole code, including what I already gave you.

Replace the entire sub build_html_record with the following:

Code:
sub build_html_record {
# --------------------------------------------------------
# Builds a record based on the config information.
#
my (%rec) = @_;
my ($output, $field);

$output = "<p><table border=0 width=450>";
foreach $field (@db_cols) {
next if ($db_form_len{$field} == -1);
next if (($db_form_len{$field} == -2) && (!$per_admin));
$output .= qq~<tr><td align=right valign=top width=20%><$font>$field:</font></td>
<td width=80%><$font>~;

if ($rec{$field} =~ /^http:/) {
$output .= qq~<a href="$rec{$field}">$rec{$field}</a>~;
}
elsif ($rec{$field} =~ /.+\@.+\..+/) {
$output .= qq~<a href="mailto:$rec{$field}">$rec{$field}</a>~;
}
else {
$output .= $rec{$field};
}
$output .= qq~</font></td></tr>~;
}
$output .= "</table></p>\n";
return $output;
}



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





Quote Reply
Re: What does this mean? In reply to
The -2 for admin only fields only works with text fields and only if you are using the autogenerate feature.

Are you saying that your search form has the values already filled in? That should only be on the add form.


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





Quote Reply
Re: What does this mean? In reply to
I am using auto generate. I am saying when someone does a search the userid is displayed under the other fields displayed. The older version did not display the userid.

I don't really want the user ID to show.

Thank you so much for all your help. I did get the password change to work. I am trying to get the send password to work as well but I made a mistake somewhere but I am getting much better with the help of this forum. One of the best I have ever seen.

Thanks again.
Venice
Quote Reply
Re: What does this mean? In reply to
Oh, you're talking about the search results. I thought you were talking about the search form.

Look in your db.cgi file and search for

sub build_html_record {

You'll see a couple of lines that say

Code:
foreach $field (@db_cols) {
next if ($db_form_len{$field} == -1);

Just below those lines, add

Code:
next if (($db_form_len{$field} == -2) && (!$per_admin));

Glad we're able to help! Smile

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





Quote Reply
Re: What does this mean? In reply to
It Worked!!!! Thanks so much. Now I think I am going to delete the popular thing. I doubt if it is really needed anyway. Okay last item. I saw on one of the other discussion threads thier was info on making the URL and Email a clickable link if using the auto generate form.

print qq~<a href="$rec{$field}"><$font>$rec{$field}</font></a>~;
}
elsif ($rec{$field} =~ /.+\@.+\..+/) {
print qq~<a href="mailto:$rec{$field}"><$font>$rec{$field}</font></a>~;
}
else {
print qq~<$font>$rec{$field}</font>~;
}
print qq~</td></tr>~;
}

On which file do I use this on and where do I place it.

Now off to play with the file upload and the send the password in the email changes. I know I will be back. LOL

Thanks

Venice


Quote Reply
Re: What does this mean? In reply to
Okay put it into the db.cgi and now I get an error. Error Message : fatal error: Undefined subroutine &main::build_html_record_form called at ./html.pl line 231.
Script Location : /www/courtyard/dman/db.cgi


The html is at http://www.courtyard.net/html.txt
the DB.cgi
http://www.courtyard.net/db.txt

Do I need to change something in thier as well?

Now what is weird is that it when I log on as an administrator the script works great. The URL and Email link is underlined and clickable. The error message is just when I try to do a search without loggin on.

Jeez guess nothing can be easy. LOL
Thanks
Venice
Quote Reply
Re: What does this mean? In reply to
You replaced too much of the script. Smile

You need to paste this just above

sub get_time

Code:
sub build_html_record_form {
# --------------------------------------------------------
# Builds a record form based on the config information.
#
my (%rec) = @_;
my ($output, $field);

$output = "<p><table border=0>";
foreach $field (@db_cols) {
if ($db_select_fields{$field}) {
$output .= "<tr><td align=right valign=top width=20%>
<$font>$field:</font></td><td width=80%>" .
&build_select_field($field, $rec{$field}) . "</td></tr>";
}
elsif ($db_radio_fields{$field}) {
$output .= "<tr><td align=right valign=top width=20%>
<$font>$field:</font></td><td width=80%>" .
&build_radio_field($field, $rec{$field}) . "</td></tr>";
}
elsif ($db_checkbox_fields{$field}) {
$output .= "<tr><td align=right valign=top width=20%>
<$font>$field:</font></td><td width=80%>" .
&build_checkbox_field ($field, $rec{$field}) . "</td></tr>"; }
elsif ($db_form_len{$field} =~ /(\d+)x(\d+)/) {
$output .= qq~<tr><td align=right valign=top width=20%>
<$font>$field:</font></td><td width=80%>
<textarea name="$field" cols="$1" rows="$2">$rec{$field}</textarea></td></tr>~; }
elsif ($db_form_len{$field} == -1) {
$output = qq~<input type=hidden name="$field" value="$rec{$field}">$output~; }
elsif ($db_form_len{$field} == -2) {
$per_admin ?
($output .= qq~<tr><td align=right valign=top width=20%><$font>
$field:</font></td><td width=80%><input type=text name="$field" value="$rec{$field}"
maxlength="$db_lengths{$field}"></td></tr>~) :
($output = qq~<input type=hidden name="$field" value="$rec{$field}">$output~); }
else {
$output .= qq~<tr><td align=right valign=top width=20%>
<$font>$field:</font></td><td width=80%><input type=text name="$field" value="$rec{$field}"
size="$db_form_len{$field}" maxlength="$db_lengths{$field}"></td></tr>~; }
}
$output .= "</table></p>\n";
return $output;
}

It shouldn't have worked at any time when you needed a form. The display will work just fine.

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





Quote Reply
Re: What does this mean? In reply to
You are awesome. Okay I will give it a rest until latter tonight. LOL Thanks so much. Works Great.

Venice