Gossamer Forum
Home : Products : DBMan : Installation :

Default Viewing

Quote Reply
Default Viewing
Hello,

I've set up a dbman database with registered user who can view, add, modify, delete their own messages. However, I also want vistors to be able to view all the records. However, when logging in as "guest" which only allows viewing the database will not display records searched for or when using the "list all" link.
Any suggestions as to how to remedy this? Below is my default.cfg file.

# =====================================================================
# File and URL's
# --------------------------------------------------------
# URL of the directory dbman resides in. No Trailing Slash Please.
$db_dir_url = "http://www.Northbirding.com/cgi-bin/fop";
# URL of dbman.
$db_script_url = $db_dir_url . "/db.cgi";
# Full Path and File name of the database file.
$db_file_name = $db_script_path . "/default.db";
# Full path and file name of the counter file.
$db_id_file_name = $db_script_path . "/default.count";
# Full path and file name of the authorization directory.
$auth_dir = $db_script_path . "/auth";
# Full path and file name of the password file.
$auth_pw_file = $db_script_path . "/default.pass";
# Full path and file name of the log file.
$auth_log_file = $db_script_path . "/default.log";
# Full path and file name of the html routines.
require $db_script_path . "/html.pl";

# Database Definition
# --------------------------------------------------------
# Definition of your database. Format is
# field_name => ['position', 'field_type', 'form-length', 'maxlength', 'not_null', 'default', 'valid_expr']

%db_def = (
'Record' => [ 0, 'numer', 20, 255, 1, '', '\d{1}'],
'Species Name' => [ 1, 'alpha', 20, 255, 1, '', ''],
'Birder Name' => [ 2, 'alpha', 20, 255, 1, '', ''],
'County' => [ 3, 'alpha', 20, 255, 1, '', ''],
'Location' => [ 4, 'alpha', '45x5', 1000, 1, '', ''],
'Date' => [ 5, 'date', 20, 255, 1, &get_date(), ''],
'Time' => [ 6, 'alpha', 20, 255, 1, '', ''],
'BBS Code 1' => [ 7, 'alpha', 0, 9, 1, '', ''],
'BBS Code 2' => [ 8, 'alpha', 20, 255, 0, '', ''],
'Habitat Code 1' => [ 9, 'alpha', 0, 21, 1, '', ''],
'Habitat Code 2' => [10, 'alpha', 0, 26, 0, '', ''],
'Abundance Code' => [11, 'alpha', 0, 14, 1, '', ''],
'Comments' => [12, 'alpha', '45x5', 1000, 0, '', ''],
'User' => [13, 'alpha', 20, 255, 1, '', '']
);

# 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 = 'Record';
# 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 = 1;
# Auto generate the html forms (1 = Yes, 0 = No).
$db_auto_generate = 0;
# 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 = 0;

# Select fields. Field name => 'comma seperated list of drop down options'.
%db_select_fields = (
'BBS Code 1' => 'Observed,Possible,Probable,Confirmed',
'Habitat Code 1' => 'Upland Forest,Lowland Forest,Upland Shrub/Savanna,Lowland Shrub/Savanna,Upland Open,Lowland Open,Urban Rural',
'Habitat Code 2' => 'Hardwoods,Coniferous,Mixed Hardwoods/Coniferous,Agricultural,Native,Uncropped,Water/Wetland,Urban,Small Town,Rural,Commercial,Residential,Open Space,Artificial Structure,Cliff,Woods Edge,Island,Dune,Grazed',
'Abundance Code' => 'Non-breeding,1 pair,2-10 pairs,11-100 pairs,101-1000 pairs,1000+ pairs'
);

# Radio fields. Field name => comma seperated list of radio buttons.
%db_radio_fields = (

);

# Checkbox fields. Field name => Checkbox value.
%db_checkbox_fields = (

);

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

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

# 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 = "http://www.Northbirding.com";


# ===========================================================================
# Build up some variables from your definitions. Internal use only.
foreach (sort { $db_def{$a}[0] <=> $db_def{$b}[0] } keys %db_def) {
push (@db_cols, $_);
$db_sort{$_} = $db_def{$_}[1];
$db_form_len{$_} = $db_def{$_}[2];
$db_lengths{$_} = $db_def{$_}[3];
$db_not_null{$_} = $db_def{$_}[4];
$db_defaults{$_} = $db_def{$_}[5];
$db_valid_types{$_} = $db_def{$_}[6];
($_ eq $db_key) and $db_key_pos = $db_def{$_}[0];
}
1;
Quote Reply
Re: Default Viewing In reply to
As mentioned in the README file and also posted many times in the DBMAN Discussion Forum, you have to use the default user in the URL to access your database.

Like the following:

Link:

Code:
<a href="http://www.yourdomain.com/cgi-bin/dbman/db.cgi?db=default&uid=default">Access Database</a>

External Search Form:

Add the following hidden fields:

Code:
<input type="hidden" name="db" value="default">
<input type="hidden" name="uid" value="default">

Please look at the FAQs in the Resource Center, then search the forums thoroughly, then post your question if you can't find an answer.

Thank you.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Default Viewing In reply to
Hi Eliot,

The tag you suggested does not resolve the problem. Still when trying to do a search under view only the database returns a message:
"There were problems with the search. Reason: no matching records."

However, there are records in the database?

Do you have any further suggestions?

Thanks so much :-)

Keith F. Saylor
Quote Reply
Re: Default Viewing In reply to
The tag I gave you should work, unless you have placed special restrictions or conditional if statements in the html_record sub routine that precludes the default user from searching fields in your database.

I tried the arguments in your database query string and guess what...it WORKED!

I used "Regular" as a criterion for Status!

Go here:

http://www.Northbirding.com/...gi/db.cgi?db=default

The reason you got "here were problems with the search. Reason: no matching records" is that your search was too narrow or too broad, and the search engine was unable to find any records that matched your search criteria!

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Default Viewing In reply to
Hello Eliot,

The database you checked is a different database on my site. That database is not set up for multiple users to create their own accounts and to modify, delete, add their own records.

Please reference the default.cfg script I added earlier. The URL to the database I'm having the problems with is:
http://www.Northbirding.com/cgi-bin/fop/db.cgi

Thanks

Keith F. Saylor
Quote Reply
Re: Default Viewing In reply to
Out of curiosity...Does this particular database have a different name rather than default??? You have to use the name of the database rather than default for the value of the db argument in the query string when you are linking to it from an external web page OUTSIDE of the DBMAN directory.

Also, when I wrote that you use the hidden fields I gave you external search forms, I meant in pages OUTSIDE of the DBMAN directory .

You would use the original hidden fields, like the following within the sub html_view_search routine:

Code:
<input type=hidden name="db" value="$db_setup">
<input type=hidden name="uid" value="$db_uid">

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Default Viewing In reply to
Eliot,

The database is name default. I made no changes to the database.

My problem has nothing to do with searching from outside of the database. These problems exhibit themselves from within database itself. Everyone can search and find their the data that they've entered. However, when I enter the URL you orginally suggested so anyone wishing to just view the data in the datbase none of the data is displayed.

This problem has manifested itself when I made set the database for people the modify, view, delete, only the data they've entered. I'm trying to make it possible for anyone to simply view the data in the database. This is the problem. The database won't display records from the default (1,0,0,0,0).

Keith

Quote Reply
Re: Default Viewing In reply to
Well, with the configurations you have posted the default user SHOULD work...While you have stated you have not changed the database script, I am not convinced.

What code hacks have you implemented in any of the scripts, including auth.pl file?

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums