Gossamer Forum
Home : Products : DBMan : Customization :

Database Definition Creator

(Page 2 of 2)
> >
Quote Reply
Re: Database Definition Creator In reply to
OK I changed everything back. Where do I go from here?
Quote Reply
Re: Database Definition Creator In reply to
I'm not really sure. I hate to do this to you, but I need you to restate your problem. There's been a lot of discussion since you first started this thread and I'm not sure what it is that you need. Or what you have, for that matter.


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





Quote Reply
Re: Database Definition Creator In reply to
At this stage I'm trying to get back to where I was some time ago. It appears to me that the log on screen will not allow log ons. When I enter data and hit logon, it blinks like it is doing something but just returns me to the logon screen. Here is the pertinent parts of default.cfg:
%db_def = (
'ID' => [0, 'numer', -2, 50, 0, '', '' ],
'First Name' => [1, 'alpha', 20, 50, 1, '', '' ],
'Last Name' => [2, 'alpha', 20, 50, 1, '', '' ],
'Maiden Last Name' => [3, 'alpha', 20, 50, 0, '', '' ],
'Class of' => [4, 'numer', 4, 4, 0, '1949', '' ],
'Address' => [5, 'alpha', 20, 50, 0, '', '' ],
'City' => [6, 'alpha', 20, 50, 0, '', '' ],
'State' => [7, 'alpha', 20, 50, 0, '', '' ],
'Zip' => [8, 'numer', 20, 50, 0, '', '' ],
'Home Phone' => [9, 'numer', 20, 50, 0, '', '' ],
'Work Phone' => [10, 'numer', 20, 50, 0, '', '' ],
'Fax Number' => [11, 'numer', 20, 50, 0, '', '' ],
'Birthday' => [12, 'alpha', 20, 50, 0, '', '\d' ],
'Email' => [13, 'alpha', 20, 50, 0, '', '\@' ],
'ICQ#' => [14, 'numer', 20, 50, 0, '', '' ],
'Home Page' => [15, 'alpha', 20, 50, 0, '', '' ],
'Occupation' => [16, 'alpha', 20, 50, 0, '', '' ],
'Biography' => [17, 'alpha', 40x3, 120, 0, '', '' ]
);

# The column name for the database key. Can be any column, but it must be unique!
# You can't have two records with the same key value!
$db_key = 'ID';
# Track the key? Should DBMan keep a counter of the next key to use? This isn't
# neccessary if you can guarantee that your entry in the key field will be unique
# (i.e. a userid).
$db_key_track = 1;
# Database delimeter.
$db_delim = '|';
# Use file locking (1 = Yes, 0 = No). Should be used, but won't work on Win95.
$db_use_flock = 0;
# Auto generate the html forms (1 = Yes, 0 = No).
$db_auto_generate = 1;

# Display Benchmarking Information (1 = Yes, 0 = No).
# use Benchmark; # Uncomment this line if benchmarking is used.
$db_benchmark = 0;
# Display Debugging Information (1 = Yes, 0 = No).
$db_debug = 1;

# Select fields. Field name => 'comma seperated list of drop down options'.
%db_select_fields = (
Category => 'General,Configuration Management,Project Management,Process Improvement,Standards,Testing & Quality Assurance',
Type => 'Web,Newsgroup,Mailing List,FTP,Gopher'
);

# Radio fields. Field name => comma seperated list of radio buttons.
%db_radio_fields = ( Validated => 'Yes,No' );

# Checkbox fields. Field name => Checkbox value.
%db_checkbox_fields = ( Popular => 'Yes' );

# Default maximum number of hits returned in a search.
$db_max_hits = 10;
# Bold search results (1 = Yes, 0 = No).
$db_bold = 1;
# Regular and title fonts used in auto_generation and html.pl.
$font = 'font face="verdana,arial,helvetica" size="2"';
$font_title = 'font face="verdana,arial,helvetica" size="4"';

# Authorization Options
# --------------------------------------------------------
# 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 = 0;

# 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,1,0,0,0);

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

# Permissions a new signup should get.
@auth_signup_permissions = (1,1,1,1,0);

# 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 = 1;

# 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;

# URL to send user if they chose log off. Leave blank and the script will return to
# the logon prompt (although this only makes sense if you are using authentication).
$auth_logoff = ".";

Several times I thought I had it going right but I made one last tweak and I'm screwed up. I imagine you are sick of it by now.
Quote Reply
Re: Database Definition Creator In reply to
 Smile Oh, I have moments when I'm pretty patient. (And then there are other moments!)

Since you've changed servers, have you been able to get the demo to run?

I see a problem with your .cfg file.

You have

$auth_modify_own = 1;
$auth_view_own = 1;

and

$auth_user_field = -1;

If you want users to only be able to modify and view their own records, you will need to have an $auth_user_field.

If you haven't tried the demo on your new server, I would do that first, though. Let's just be sure that paths and stuff are right before we go on. (I'm a real believer in "one step at a time." Smile )


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





Quote Reply
Re: Database Definition Creator In reply to
I already have set up the new server, in fact that's when my NEW problems started but the old one didn't get much further. How do you set up the auth_user field. Is this any field or a special one set up for just this purpose. Finally I want to restate my minimum objective. I would like the user to be able to set up a record. Once set up and with user id and password be able to delete or modify his own record only but could view all records. Once the user is set up he would be validated either manually or if possible with programming. I'm cutting through the frustation and awaiting your thoughts.
Quote Reply
Re: Database Definition Creator In reply to
If you want records to be associated with the users who created them, you must create a field for the userid. I usually call it "Userid." You set up the field as you would set up any field. You can set the "maxlength" of the field to 12, since DBMan only allows userids that are between 3 and 12 characters in length.

Then you set the $auth_user_field variable to the number of the Userid field. The userid will be automatically added to the record when the record is added.

If you want each user to have only one record, set your $db_key variable to the name[/b] of your Userid field. It would be like

$db_key = 'Userid';

You would also set $db_key_track = 0; because you wouldn't want to increment a counter if you're using the Userid field.

You said:

Quote:
I would like the user to be able to set up a record. Once set up and with user id and password be able to delete or modify his own record only but could view all records. Once the user is set up he would be validated either manually or if possible with programming.

The way DBMan works is that the user first signs up for a username and password and then adds a record. It may be that you already understand that, but it wasn't clear from what you wrote.

Do you want users to be able to sign up for accounts online or do you want to add user's names yourself through the "Admin" link?

I have written code for several different validation routines. I haven't got a mod made up yet, because there are a number of different options that people might want to use and each requires different coding. But, if you'll tell me what you want, I can give you one of them here on the forum.

Primarily the question comes in with whether you want to send email to the person whose record is either validated or deleted. And if you want to send a "canned" email message to each one or to be able to edit the email message before it goes out.

Take a deep breath. I know it's frustrating, but you'll get there. Smile


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





Quote Reply
Re: Database Definition Creator In reply to
Sorry to digress but I just ran across a minor problem. Apparently Dbman is looking for a file named stream.key and can't find it and keeps giving me error codes. Do you know what it is?
Quote Reply
Re: Database Definition Creator In reply to
Never heard of a file like that. Where do you get the message that it's looking for the file?


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





Quote Reply
Re: Database Definition Creator In reply to
This is the message and it is in my server error log.
204245103163.bellatlantic.net [08/Aug/1999:17:20:24 -0400] File not found: c:\dbman\stream.key
I thought it must be related to dbman since it's looking for it in that directory.
Quote Reply
Re: Database Definition Creator In reply to
Nope. I would check with your ISP sysadmin to see if he/she has any ideas.


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





Quote Reply
Re: Database Definition Creator In reply to
Very fun! The music gave me a smile. Smile

I'm wondering why your login form doesn't seem to want to work. It looked fine when I looked at the source code.

Hmmmmmm.....


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





Quote Reply
Re: Database Definition Creator In reply to
In this case, because it's my server my ISP is me. I asked me but he didn't know. (:<
( Smile
Quote Reply
Re: Database Definition Creator In reply to
LOL!!!!!!!!

I really needed that this morning.

You might try searching the whole drive for a file named stream.key. Sounds like it might be something the server software is looking for.


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





Quote Reply
Re: Database Definition Creator In reply to
Yes I tried searching to no avail. I even created a file and named it stream.key and it didn't seem to have any impact. I'm working on the Omni side of it so maybe they will come up with something. Meanwhile my dbman is working pretty good. It doesn't do exactly what I want but I never could get to utopia so I may settle for this. Please try it and see what you think. http://postmodem.com/dips/shadow/root/dbman/dbmain.htm I hope you have sound to listen to the jazzy music!
Quote Reply
Re: Database Definition Creator In reply to
Did you check your db.cgi for a stream.key. I got a similar error message for the database tracking mod I installed.

Code:
The description for Event ID ( 4101 ) in Source ( Ci ) could not be found.
It contains the following insertion string(s): c:\inetpub\wwwroot\coconino\cgi-bin\directory\data\keywords.txt, 8.

I was curious why a particular DBMAN project was running slow compared to other projects, then I realized that I had a bunch of test mods to the index.cgi file. I also analyzed the Applications Event Log file.

Possibly, there is some routine in your db.cgi file that is pointing to stream.key.

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

[This message has been edited by Eliot (edited August 09, 1999).]

[This message has been edited by Eliot (edited August 09, 1999).]
Quote Reply
Re: Database Definition Creator In reply to
Now that's strange. It does work for me. This is the kind of computer voodoo that drives one crazy. I used to be a help desk guru for mainframes and pc's and I would go out and fix a particular problem and never know what I did to fix it! It just started working after I played with it and rebooted it. etc. I was a programmer too but I never solved programming problems that way. You've got to be too precise as you well know. But I digess . Did you notice that when my page comes up it drops down to the input box. Any clue why it does that? I really don't want it to. By the way I really like this discussion software. Is it a cgi thing too? And available?
Quote Reply
Re: Database Definition Creator In reply to
leokelly,

Look in the <body> tags of your form sub-routines. You will see onLoad....
This java script command takes people directly to the form on the page. Just delete the onLoad... codes and the page will load to the top of the page.

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
Quote Reply
Re: Database Definition Creator In reply to
The reason it drops down to the form is that you have

onLoad="document.form1.userid.focus()"

in your <body> tag. Take that out and it won't jump down.

UBB is available at http://www.UltimateBB.com/



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





Quote Reply
Re: Database Definition Creator In reply to
Hi. I apologize for posting here, since the title of this post ins't really what I need help with, but it is the closest match!

I have used the code supplied above by JPD for the "valid expressions" in a date field, altering the end to force a 4 digit year as follows:
Code:
\d{2}\/\d{2}\/\d{4}
And I have also successfully forced a \d.\d{2} for #.## format.

My question is this... how woule I go about coding to allow specific number entry in a field .... i.e. 1.25, 1.50, 1.75, etc... so that the only allowable entries are from 0.25 to 24.00 in increments of .25 ??

Anyone have the answer??

Thanks !

keienb
Quote Reply
Re: Database Definition Creator In reply to
There was a thread a week or two ago where someone wanted to verify that values were within a certain range. (I'm not saying you should have found it. It wouldn't be available through the search of the forum. Just recalling it.)

You would have to add code to sub validate_record to account for this.

If you haven't already made changes to sub validate_record, replace it with the following:

Code:
sub validate_record {
# --------------------------------------------------------
# Verifies that the information passed through the form and stored
# in %in matches a valid record. It checks first to see that if
# we are adding, that a duplicate ID key does not exist. It then
# checks to see that fields specified as not null are indeed not null,
# finally it checks against the reg expression given in the database
# definition.

my ($col, @input_err, $errstr, $err, $line, @lines, @data);

if ($in{'add_record'}) { # don't need to worry about duplicate key if modifying
open (DB, "<$db_file_name") or &cgierr("error in validate_records. unable to open db file: $db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB> ) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
$line = $_; chomp ($line);
@data = &split_decode($line);
if ($data[$db_key_pos] eq $in{$db_key}) {
return "duplicate key error";
}
}
close DB;
}
foreach $col (@db_cols) {
if ($in{$col} =~ /^\s*$/) { # entry is null or only whitespace
($db_not_null{$col}) and # entry is not allowed to be null.
push(@input_err, "$col (Can not be left blank)"); # so let's add it as an error
}
else { # else entry is not null.
($db_valid_types{$col} && !($in{$col} =~ /$db_valid_types{$col}/)) and
push(@input_err, "$col (Invalid format)"); # but has failed validation.
(length($in{$col}) > $db_lengths{$col}) and
push (@input_err, "$col (Too long. Max length: $db_lengths{$col})");
if ($db_sort{$col} eq "date") {
push (@input_err, "$col (Invalid date format)") unless &date_to_unix($in{$col});
}
if ($col='FieldName') {
if (($in{$col} < .25) or ($in{$col} > 24)) {
push(@input_err,"$col (not within range)");
}
unless ($in{$col}*100/25 == int($in{$col}*100/25)) {
push(@input_err,"$col (incorrect value)");
}
}
}
}

if ($#input_err+1 > 0) { # since there are errors, let's build
foreach $err (@input_err) { # a string listing the errors
$errstr .= "<li>$err"; # and return it.
}
return "<ul>$errstr</ul>";
}
else {
return "ok"; # no errors, return ok.
}
}

Notice that you will need to change FieldName to match the name of your field.

The best way to copy the code is to click the "Edit" icon on this message and copy it from there. This will allow you to keep the formatting I put into it. Smile

If you have already made changes to sub validate_record for some other reason and can't figure out what changes you need to make, post your subroutine here and I'll show you where to put the new code.


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






Quote Reply
Re: Database Definition Creator In reply to
JPD:

WOW! ... and I thought it was gonna be as easy as adding the 'valid_expr' that I mentioned in my post Smile

I had to tweak a bit, cuz there were already several changed to my sub validate_record, but I did get it working ... like a charm - but what does one expect from you?? You're always so quick to lend a hand!

One question, tho ... when I attempt to enter an INVALID expression to test the validation, it gives me the error message (out of range) SIX times instead of just once .... ???

Thanks again!
keienb
Quote Reply
Re: Database Definition Creator In reply to
It would be nice if there was a regular expression to do what you want, but, alas, no such luck.

I see what the problem is. I made a bonehead error.

Code:
if ($col='FieldName') {

should be

Code:
if ($col eq 'FieldName') {

That should fix the problem.


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






Quote Reply
Re: Database Definition Creator In reply to
Beautiful!!! That took care of it Smile

Thanks again! You're an angel!

keienb
> >