Gossamer Forum
Home : Products : DBMan : Installation :

Problem with customer seeing their own records

Quote Reply
Problem with customer seeing their own records
I am having a problem letting my customer see their own records only.

For example: Even though I have a few test records with the owner as "dowchem", when I do a list all, it will say "no matching records"

I have created a webpage so that you can see all my files and code... http://souheat.com/dbman.htm. I renamed all the files to .txt so you can pull them up in your browser.

I want the customer to only be able to "view only" their own records.

Any help would be appreciated. I am ready to register if I can get this working.
Quote Reply
Re: [sheco] Problem with customer seeing their own records In reply to
Try turning off default viewing

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

$auth_allow_default = 0;

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Problem with customer seeing their own records In reply to
Thanks for your quick reply, but it still comes back with "no matching records"
Quote Reply
Re: [sheco] Problem with customer seeing their own records In reply to
Although you don't have tracking turned on in your .cfg file that field should be defined as a number field. Also your date should be defined as a date field.

I checked your html.pl file and you don't have a userid field defined in your add form. You must include all the fields defined in the .cfg file in within sub html_record_form. You can make this a hidden field or for admin only to view. That is probably what is causing the problem, as the userid field is not being written to the database. You will have to manually add this to any existing records in the database.

Also the -2 only works if you use autogenerate.

ShecoNo => [0, 'numer', 10, 15, 1, '', ''],
Customer => [1, 'alpha', 40, 255, 1, '', ''],
PONo => [2, 'alpha', 40, 255, 1, '', ''],
ItemNo => [3, 'alpha', 40, 255, 1, '', ''],
OrderDate => [4, 'date', 12, 15, 1, '', ''],
TemaSize => [5, 'alpha', 8, 10, 1, '', ''],
TemaType => [6, 'alpha', 3, 4, 1, '', ''],
SchShip => [7, 'alpha', 12, 15, 1, '', ''],
ActShip => [8, 'alpha', 12, 15, 0, '', ''],
Userid => [9, 'alpha', -2, 15, 0, '', '']

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Problem with customer seeing their own records In reply to
Thanks I will try to change that. I did not make any modifications to the add form because no one will be adding to the database from the web. All the info in the database will be exported from an existing MS Access database and uploaded to the web.
Quote Reply
Re: [sheco] Problem with customer seeing their own records In reply to
That did not seem to work either. If you view my default.db file you will see that slot #9 is my userid field. That info is in the database. You will see several records with "dowchem" as the userid. So when I log on as "dowchem" I should be able to see the records that have "dowchem" in the userfield correct?
Quote Reply
Re: [sheco] Problem with customer seeing their own records In reply to
Each field listed in your .cfg file MUST have a matching field defined in your add_form even if you are not going to use the form to enter information you will see that form when modifying, etc.

Okay, a couple of things now that I looked at your database also. The default date format as your current db.cgi file is setup within sub get_date as dd-mmm-yy. You are using various formats within your .db file. Some with - and others with /. You need to be consistant with the date format and be sure that your .cgi file is setup to accept that format. Did you change the fields defintions to dates?

I actually thought you had to add the full year unless you used the modification by JPDeni to allow for partial dates?

Another silly question, did you add the username and password using the admin function or the signup form? The user would have to be in the password file to be recognized with their set permissions, etc.

It's good you mentioned you added the current records without using the add form, cause that helps to explain things. Perhaps you should use the add form to just test and be sure everyting is working correctly prior to updating the database file offline.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Problem with customer seeing their own records In reply to
I hope you know how much I appreciate your help.

The date field in my database is set up as text field and not a date field because it does not use the date field for anything besides to print out. Thus it will be able to use any format since it is text and not a real date, as far as the script goes it should not think its a date but just another text field. No searches , etc will be performed by date. Does that make sense?

I added the user "dowchem" via the admin add user feature.

I have added a few records via the add form logged in as the admin and then edited the userid to "dowchem" and also tried it by giving "dowchem" user add/edit capabilities and it still did not work.

I think I do have a matching field on my add form for all my fields. I posted a revised copy on http://souheat.com/dbman.htm

When I do a "list all" while logged in as the Admin, all records list perfectly. So I would think it has to have something to do with the user authentication. If it was some other error in the fields, date, etc I wouldn't think it would let me do that at all.

At the moment I am just trying to make sure I can make it where the logged in customer can only see his orders. I will be modifying the layout and html later after I get that working.
Quote Reply
Re: [sheco] Problem with customer seeing their own records In reply to
You made an error defining the hidden field:

change:
<INPUT TYPE="hidden" NAME="ActShip" VALUE="$rec{'Userid'}" SIZE="12" MAXLENGTH="15">

to:
<INPUT TYPE="hidden" NAME="Userid" VALUE="$rec{'Userid'}" SIZE="12" MAXLENGTH="15">

I don't see anything else that could be causing problems.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Problem with customer seeing their own records In reply to
Thanks for trying.

I gave "dowchem" user add permissions and added a record that way and it worked. When I click "List All" it shows the record I added via the web and no others. Looking at the database everything is in place with the other records that I had set manually to "dowchem" userid. Does this program store the owner of a record some other place other than in the userid field in the database file itself? I thought it would just search through the database and list all records that have "dowchem" in the userid field but apparently it does not.
Quote Reply
Re: [sheco] Problem with customer seeing their own records In reply to
I figured out the problem. If I append a return character (which looks like a square) to the end of each record it works perfectly. If I just hit return it will not.