Gossamer Forum
Home : Products : DBMan : Discussions :

Can't modify or manage users

Quote Reply
Can't modify or manage users
My database is working fine for most functions. I can add, list, search just fine. However, I went to change a user's password and I found I could not. Further investigation showed I also cannot add a new user or modify a record in the database. When I try to modify a record, I get as far as the search form, looking for the record to modify. When I hit search, I get the error:

Quote:
DBMan encountered an internal error. Please enable debugging to view.

I get the same error when I click on a user in User Management and hit the Inquire button.

So, I did as the program told me and enabled debugging in default.cfg, but no further errors are returned. I perform the same actions, and the same generic, "DBMan encountered an internal error. Please enable debugging to view." error comes up. Frown

I have checked permissions on files and folders, and they are fine. I checked the database itself, and the 20,000+ records are all fine. Crazy Well what the heck is wrong? Any ideas anybody?
Quote Reply
Re: [jadey] Can't modify or manage users In reply to
Gotta be something wrong with default.cfg - post a copy here as an attachment and let somebody look at it. If that doesn't work then we'll need to see the html.pl file.
Quote Reply
Re: [Watts] Can't modify or manage users In reply to
Okay, here's a peek at it. Thanks for your help!

Code:
# ----------------------

# DBMan

# ----------------------

# Database Administrator

#

# File: default.cfg

# Description: This is the setup file that contains the database definition,

# and most of the options required to set the program up.

# Author: Alex Krohn

# Email: alex@gossamer-threads.com

# Web: http://www.gossamer-threads.com/

# Version: 2.04

#

# COPYRIGHT NOTICE:

#

# Copyright 1997 Gossamer Threads Inc. All Rights Reserved.

#

# This program is being distributed as shareware. It may be used and

# modified free of charge for personal, academic, government or non-profit

# use, so long as this copyright notice and the header above remain intact.

# Any commercial use should be registered. Please also send me an email,

# and let me know where you are using this script. By using this program

# you agree to indemnify Gossamer Threads Inc. from any liability.

#

# Selling the code for this program without prior written consent is

# expressly forbidden. Obtain permission before redistributing this

# program over the Internet or in any other medium. In all cases

# copyright and header must remain intact.

#

# Please check the README file for full details on registration.

# =====================================================================

# File and URL's

# --------------------------------------------------------

# URL of the directory dbman resides in. No Trailing Slash Please.

$db_dir_url = "http://www.mydomain.ca/cgi-bin/inquiries";

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

# Full path to sendmail on your system

$mailprog = "|/usr/lib/sendmail -t -oeq";

# Your email address

$admin_email = 'inquiries@mydomain.ca';

$recipient_email = '';

$db_email_field = 'Email';

$print_get_cookies = "1";



# Database Definition

# --------------------------------------------------------

# Definition of your database. Format is

# field_name => ['position', 'field_type', 'form-length', 'maxlength', 'not_null', 'default', 'valid_expr']



%db_def = (

'Number' => [ 0, 'numer', -1, 255, 1, '', ''],

'Name' => [ 1, 'alpha', 40, 255, 1, '', ''],

'Address' => [ 2, 'alpha', 40, 255, 1, '', ''],

'City' => [ 3, 'alpha', 20, 255, 1, '', ''],

'State' => [ 4, 'alpha', 3, 255, 1, '', ''],

'Zip' => [ 5, 'alpha', 7, 255, 1, '', ''],

'Country' => [ 6, 'alpha', 10, 255, 1, '', ''],

'Email' => [ 7, 'alpha', 40, 255, 0, '', '.+@.+..+'],

'SendMe' => [ 8, 'alpha', 0, 255, 1, '', ''],

'Reservation' => [ 9, 'alpha', 0, 255, 0, '', ''],

'VacationType' => [10, 'alpha', 0, 255, 0, '', ''],

'Accommodations' => [11, 'alpha', 0, 255, 0, '', ''],

'Access' => [12, 'alpha', 0, 255, 0, '', ''],

'Arrival' => [13, 'alpha', 10, 255, 0, '', ''],

'Duration' => [14, 'alpha', 10, 255, 0, '', ''],

'Party' => [15, 'alpha', 10, 255, 0, '', ''],

'Description' => [16, 'alpha', '40x5', 1000, 0, '', ''],

'Referrer' => [17, 'alpha', 0, 255, 0, '', ''],

'Origin' => [18, 'alpha', 0, 255, 0, '', ''],

'Date' => [19, 'date', 20, 255, 0, &get_date(), '']

);



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

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

##############################################
# PDF Label export addition
# PDFlabels
# Path and file name of the pdf routines.
require $db_script_path . "/pdflabels.pl";

# Actual path to the public directory holding the exported pdf files for MSIE users
# (Make sure that this directory is chmod 777 on Unix servers)
$db_pdf_filexport_path = "/home/httpd/vhosts/mydomain.ca/httpdocs/PDFlabels"; # No trailing (/)

# Actual url to the public directory holding the exported pdf files for MSIE users
$db_pdf_url = "http://www.mydomain.ca/PDFlabels"; # No trailing (/)
##############################################

# Select fields. Field name => 'comma seperated list of drop down options'.

%db_select_fields = (

'Referrer' => 'SearchEngine,Another-Site,In-Fisherman,Field-and-Stream,From the Canadian Fishing Map',

'Origin' => 'Website,1-800'

);



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

%db_radio_fields = (

'SendMe' => 'Fishing Map,I already have a current Canadian Fishing Map',

'Reservation' => 'Yes,No'

);



# Checkbox fields. Field name => Checkbox value.

%db_checkbox_fields = (

'VacationType' => 'Fishing,Small Game Hunting,Big Game Hunting,Canoe Trip,EcoTour,Other',

'Accommodations' => 'American Plan,Housekeeping,Outpost,RV Park/Campground,Houseboat,Hotel/Motel,Other',

'Access' => 'Drive-In,Fly-In,Boat-In,Rail-In'

);



# Default maximum number of hits returned in a search.

$db_max_hits = 10;
$excel_max_hits = 1000;

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



# Allow people to sign up for their own userID/passwords? They will

# recieve default permissions.

$auth_signup = 0;



# Permissions a new signup should get.

@auth_signup_permissions = (0,1,0,0,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 = 0;



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



# 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.mydomain.ca/";





# ===========================================================================

# 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: [jadey] Can't modify or manage users In reply to
Everything looks kosher, No? Unimpressed
Quote Reply
Re: [jadey] Can't modify or manage users In reply to
As far as I can tell it looks okay...

next step is to post your html.pl here (as an attachment since it's kinda long).

There may be something in one of the subroutines that is off kilter.
Quote Reply
Re: [Watts] Can't modify or manage users In reply to
Here's the attachment. I appreciate your help!

Last edited by:

jadey: Nov 4, 2004, 8:40 AM
Quote Reply
Re: [jadey] Can't modify or manage users In reply to
I looked through the html.pl file and didn't see anything that just "jumped out at me"... However the export to excel subrountine has some weird pattern matching that I don't recognize... not sure what's up with that.

Try moving the debug = 1 part in the .cfg file up near the "paths" part of the .cfg file. It is supposed to give you more information that way...
Quote Reply
Re: [Watts] Can't modify or manage users In reply to
Move this line:

# Display Debugging Information (1 = Yes, 0 = No).
$db_debug = 1;

up to the top of the .cfg file (put it into the section called URL's).

Last edited by:

Watts: Nov 4, 2004, 11:58 AM
Quote Reply
Re: [Watts] Can't modify or manage users In reply to
Switching debugging on always worked before attempting the functions that won't work at all. Moving the location of the debug info up to URLs didn't have any change at all. Unsure

As in my first post, when I go to inquire a user on User Management, I get:
Quote:
DBMan encountered an internal error. Please enable debugging to view.

Even though it is enabled (set to 1) and now moved up to the URLs section. Pirate
Quote Reply
Re: [jadey] Can't modify or manage users In reply to
Sounds like there is a problem either in db.cgi (under admin_display) or with default.pass - I get the impression it is having trouble reading the pass file (or that file is corrupt?) or there's a syntax error in db.cgi that causes it to crash when that subroutine is called.
Quote Reply
Re: [Watts] Can't modify or manage users In reply to
Ok, I replaced the entire sub admin_display subroutine with one from another install (where the admin functions do work) I have on the same account, and no change. The password file permissions are correct and isn't corrupt.

What the heck is going on? Shocked

Last edited by:

jadey: Nov 5, 2004, 10:56 AM
Quote Reply
Re: [jadey] Can't modify or manage users In reply to
How many users do you have? Try renaming default.pass and uploading the old password file (the one with admin/admin guest/guest) from the original script and see if you can log in as admin/admin and manage users. If you can, then we know something is wrong with the .pass file. If you cannot (still get same error) then we know it's not the .pass file but something else.
Quote Reply
Re: [Watts] Can't modify or manage users In reply to
Good suggestion! There are only 4 users. I replaced it with a default default.pass and logged in as admin/admin. I still get the same results, so the problem isn't there. Hrm.
Quote Reply
Re: [jadey] Can't modify or manage users In reply to
Would it make a difference if you changed:

$auth_signup = 0;

to allow signups?

$auth_signup = 1;

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Can't modify or manage users In reply to
Thanks for the suggestion. Unfortunately, this didn't fix the problem. I would have been surprised, as I can't modify a record as well as modify or add a user, and this would have enabled only signing up users. It was worth a shot though. Really strange...
Quote Reply
Re: [jadey] Can't modify or manage users In reply to
Okay, something else to try. I found that using this version of the the sub cgierr seemed to display errors not shown with the original version. It's worth a try to see if you can then get the error to display. Also sometimes viewing the source of the page code in your browser might show an error message.


sub cgierr { ### modified this for security .. to not show env variables when there is an error 5/20/2000
# --------------------------------------------------------
# Displays any errors and prints out FORM and ENVIRONMENT information. Useful for debugging.

if (!$html_headers_printed) {
print "Content-type: text/html\n\n";
$html_headers_printed = 1;
}

print "<PRE>\n\nCGI ERROR\n==========================================\n";
$_[0] and print "Error Message : $_[0]\n";
if ($db_debug) { #### added this line #######
$0 and print "Script Location : $0\n";
$] and print "Perl Version : $]\n";
$db_setup and print "Setup File : $db_setup.cfg\n";
$db_userid and print "User ID : $db_userid\n";
$db_uid and print "Session ID : $db_uid\n";

print "\nForm Variables\n-------------------------------------------\n";
foreach $key (sort keys %in) {
my $space = " " x (20 - length($key));
print "$key$space: $in{$key}\n";
}
print "\nEnvironment Variables\n-------------------------------------------\n";
foreach $env (sort keys %ENV) {
my $space = " " x (20 - length($env));
print "$env$space: $ENV{$env}\n";
}
print "\n</PRE>";
####### new lines ###########
}
else {
#This links to your e-mail if someone receive a link to this page
print "\n\nPlease e-mail the <A HREF=\"mailto: $admin_email\">Webmaster</A> and report the error stated.";
}
##### end new lines ###########
exit -1;
}


----------

Something else to try:

To obtain useful error messages, add the following snippet to your script,
just beneath the shebang line (the first line of the script;
usually !#/usr/local/bin/perl or !#/usr/bin/perl):

BEGIN {
open (STDERR, ">/path/to/somewhere/error.txt");
}

Now create an empty plain text file named "error.txt"
and upload it in ASCII mode to your somewhere/ directory.
Chmod it to 777.

Now run your script from your browser.

After it gives you its error message, call your error.txt from the browser
(for example, http://www.your_site.com/somewhere/error.txt;
you might make a bookmark for it because, if you're like me, you'll be using it a lot!).

The reason for your script's failure should be written there.

Note: If you call the error.txt file more than once,
you may have to hit your browser's "reload" button.
----------------------------------
Note:

You can add this to your db.cgi and html.pl files and receive very useful error messages.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Can't modify or manage users In reply to
Thanks! I got a useful error message!

Code:
CGI ERROR
==========================================
Error Message : Error loading required libraries.
Check that they exist, permissions are set correctly and that they compile.
Reason: Invalid config file name: default~~default at db.cgi line 52.

line 52 is:

Code:
unless ($db_setup =~ /^[A-Za-z0-9]+$/) { die "Invalid config file name: $db_setup"; }

Of course default~~default is an invalid config, it should be default.cfg. I'm searching around on where to change this.

I tried hard coding in default.cfg where $db_setup is defined, like in:

Code:
require "$db_setup.cfg"; # Database Definition File

but I must be on the wrong track there, as that didn't work. I'll keep searching....
Quote Reply
Re: [jadey] Can't modify or manage users In reply to
Look a couple of lines up in db.cgi (around line 37 or so) and see if you have this:

Code:
$db_script_path = ".";

# Load the form information and set the config file and userid.
local(%in) = &parse_form;
$in{'db'} ? ($db_setup = $in{'db'}) : ($db_setup = 'default');
$in{'uid'} ? ($db_uid = $in{'uid'}): ($db_uid = '');

Somehow it's getting the name "default" two times. (the ~~ is how the two values are separated.)

Last edited by:

Watts: Nov 11, 2004, 1:52 PM
Quote Reply
Re: [Watts] Can't modify or manage users In reply to
Believe it or not I was getting the same error the other day with a new database I was creating.

I had made an error in the call to login (i think) can't remember exactly whether it was signup or login, but as soon as I corrected the A HREF call it worked fine.

Check any calls you have to login. I didn't see any within your html.pl file so it may be on a static web page.

I find it easiest to just use the <A HREF="db.cgi?db=default">Login</A>

If you include $db_script_link_url for instance it also adds the db name, and userid.

Hope that helps you narrow down your search for the error.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/