Gossamer Forum
Home : Products : DBMan : Customization :

list all on login

Quote Reply
list all on login
in html_home i'm trying to use code i found posted by JPDeni June 2000 to automatically list all records on login. it works fine on one database but on a different database, i either get a search form with error no matching records or it goes to long display of a single record. (i'm using short/long on both databases). the authentication options are the same in both: allow default user=1, view own=0, modify own=1. both show validated record to admin only. here's the code. any idea where to look for problem?

$in{$db_key} = "*";
&view_records;
return;



Quote Reply
Re: [delicia] list all on login In reply to
This is a real mystery. There must be something different in the two databases. Are you sure that each of the databases have more than one validated record in them?


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.

Last edited by:

JPDeni: Mar 15, 2005, 12:34 AM
Quote Reply
Re: [JPDeni] list all on login In reply to
ok, the problem database:

allow default user =1; view own = 0;

when i use uid=default, it goes to short display of 3 validated records (perfect)

but when i logon as a user, it goes straight to user's record. if i click on Home, it does short display perfectly, as it does if i List All.
Quote Reply
Re: [delicia] list all on login In reply to
Hmmmmmm.

And that's the only added code for when you log in? I can't think what it could be, especially since you say that both of the databases have the same authorization. Right? Both are allow default user =1; view own = 0; and both have the same code, but it works in one and not the other.

Is there anything at all that is different between the two?


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] list all on login In reply to
i can't think of anything else that's different, but it's not a top priority right now. i'll try to look at it again in the next few days. if i figure it out or find more clues, i'll let you know.
Quote Reply
Re: [delicia] list all on login In reply to
in cfg i have $admin_only =1 meaning show unvalidated to admin only. i want everyone to go to short display and show the records that user is allowed to see (all for admin, validated to everyone else).

when i login as user (not admin) it gives search error and has userid in the search form and in debug variables (wrong?). validated = yes in debug (correct). there are 3 validated records but none for this user. auth_view_own is 0 so if the user lists all he sees the 3 records (correct).

when i login as user who has a validated record, it goes straight to that user's record. list all shows all 3 validated records.

when admin logs in, it goes straight to long_record of a single record (wrong). debug shows ID=*. validated not listed in debug. neither is view_records. when admin lists all, all 7 records display (correct) and debug shows view_record =1.

in db.cgi sub view_records, i have:

if ($admin_only) {
(!$per_admin) and ($in{$db_validated_field} = "Yes"); # validated records only if not admin
}
else {
($db_userid eq "default") and ($in{$db_validated_field} = "Yes"); # validated records only if default user
}

comments above in db.cgi show what is supposed to happen about displaying validated records. and it seems to work fine

Quote Reply
Re: [delicia] list all on login In reply to
At the beginning of this thread, you said that you had two databases with the same permissions and that the code works on one, but not on the other. I'm trying to figure out what is different between them. There must be something different between them.

Both have exactly the same permissions?
Both have the same sort of validating?

As a starter, and only for debugging purposes, I would temporarly comment out the lines you added for validation in sub view_records. See if that makes a difference.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.

Last edited by:

JPDeni: Mar 16, 2005, 7:56 AM
Quote Reply
Re: [JPDeni] list all on login In reply to
unfortunately, it's been a week or so since i encountered this problem and i don't remember which database it was. (i put together five different ones for one client.) don't worry about it unless something just pops into your head.
Quote Reply
Re: [delicia] list all on login In reply to
i turned on log search results to be sure it wasn't doing a keyword search. when logged on, it was searching for userid = userid and ID=*. here are some debug results:

Form Variables (DEFAULT USER)
-------------------------------------------
ID : *
db : custom
sb1 : 3
sb2 : 2
sb3 :
so1 : ascend
so2 : ascend
so3 :
uid : default

Form Variables (LOGGED IN AS AUTHOR)
-------------------------------------------
ID : *
db : custom
login : Logon
pw : author
sb1 : 3
sb2 : 2
sb3 :
so1 : ascend
so2 : ascend
so3 :
userid : author

so it appears $in{login} is still set, as well as $in{userid} from the login screen.
Quote Reply
Re: [delicia] list all on login In reply to
update on last info: i went back to original dbman files with only one hack -- list all on login. it works and the debug variables show the userid and login. so that isn't the problem :(
Quote Reply
Re: [delicia] list all on login In reply to
A wild guess without seeing the code is that it has something to do with permissions and validation.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] list all on login In reply to
i commented out all the validated stuff. i temporarily took off my in sub query so i could see $restricted in debug variables (added at bottom like you taught me!). it was not restricted.

went back to default unmodified dbman, added log search results so i could see what the search was on login. in unmodified version, it is only searching for ID=*.

in modified version it's searching for userid=whoever is logged on and ID=*. if uid=default, then just ID=*.

in both modified and unmodified the debug variables list userid=whoever is logged on.

it seems that in modified version the search is requiring a match of userid and id, but why is it even looking at userid?
Quote Reply
Re: [delicia] list all on login In reply to
I'm not sure, but it's something in the validation code. You need to look at the code you commented out, because that's where the problem lies.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] list all on login In reply to
i copied the original sub query into my db.cgi (and renamed my customized query to query2). it still does same thing. i even re-installed the default html.pl with just this one mod and it does the same thing. this is driving me crazy.
Quote Reply
Re: [delicia] list all on login In reply to
i have the mod working but i had to add a line in sub home to clear out the userid variable:

$in{'userid'} = '';
$in{$db_key} = "*";
&view_records();
return;

it doesn't seem to have any adverse effect.
Quote Reply
Re: [delicia] list all on login In reply to
Then it is something in one of the lines that you had earlier commented out which is causing the sub query to filter out the results. If this workaround works, then you're fine. Or you could look at those lines and see where the problem is. I usually like to find the source of the problem because often it will arise in another area. But it might not arise and you'll be fine.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] list all on login In reply to
actually, those lines are still commented out. i forgot to uncomment them! the only difference i can find in sub query is in the date translator mod. but even when i put the original sub query, i had the same result. when i compared auth.pl, the only difference was making username case insensitive. autogenerate made no difference, original html made no difference. so i just gave up... but it's very frustrating not knowing!