Gossamer Forum
Home : Products : DBMan : Customization :

Fun with default user and force add member profile record...

Quote Reply
Fun with default user and force add member profile record...
My DB is configured to allow the default user to view the DB. All registered members are "forced" to add a single profile record into the member DB after signing-up (with the secure lookup mod and this code in html_home http://www.gossamer-threads.com/...m12/HTML/000864.html ). My problem is that after the default user(s) returns from viewing a record, they are confronted with the add a profile record for user "default". I suppose that I can add this record myself, and thus all other "default" users will not see it, but then there is the problem of an extra meaningless record in the DB. Anybody got any bright ideas around this?

------------------
The Immuatable Order of Modding
-=-=-=-=-=-=-=-
1. Read the FAQ, 2. Search the board, 2a. Search the board again, 3. ask the question, 4. back-up, 5. experiment, 6. rephrase question (or better yet, post solution to original question)
Quote Reply
Re: Fun with default user and force add member profile record... In reply to
Hmmm...oldmoney...are you sure you are using the correct codes?

I have this working just fine...Default users can only view records or list all records. They are never prompted to the add_form.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------







Quote Reply
Re: Fun with default user and force add member profile record... In reply to
This is where you screwed up:

Code:
if ($db_userid eq "") {
print qq|<input type=hidden name="uid" value="default">|;
}
else {
print qq|<input type=hidden name="uid" value="$db_uid">|;
}
print qq|

Simply use the following:

Code:
<input type="hidden" name="default" value="$db_uid">

This will pull a session of "default"...so, that they can navigate through your database links.

The problem is probably with the user permission links you have set up in your sub_html_footer routine.

To allow certain users to see data or do things in your database, the better thing to do is to use one of the following codes:

Code:
if ($per_view)
if ($per_add)
if ($per_del)
if ($per_mod)
if ($per_admin)

Also, the codes that you should have at the top of the html_home sub-routine is the following:

Code:
if ($per_add) {
%rec = &get_record($db_userid);
unless ($rec{$db_key}) {
&html_add_form;
return;
}
}

That's it.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. Smile
----------------------









[This message has been edited by Eliot (edited January 26, 2000).]
Quote Reply
Re: Fun with default user and force add member profile record... In reply to
Eliot, thanks for the new code for auto-add form on new registration... it works well.

re: your suggestion for the default user search, it doesn't make sense to me. What is name=default? When I try this, it 1) doesn't work for either a default or logged in user and 2) logs out a user if already logged in...

I assume you meant <INPUT TYPE=hidden NAME=uid VALUE=$db_uid>, which as I said works for a logged in user but does not for a default user... unless I'm really missing something, I think I need to assign $db_uid=default before the INPUT tag... I scrapped the if/else and just made it an

if ($db_userid eq "") { $db_uid="default"; }

I also changed the navigational header from per_view to per_add on your suggestion which solved the original problem of the add_record_form getting automatically called since the default user now never sees the home_html form. *sigh -- I should have thought of that!*

------------------
The Immuatable Order of Modding
-=-=-=-=-=-=-=-
1. Read the FAQ, 2. Search the board, 2a. Search the board again, 3. ask the question, 4. back-up, 5. experiment, 6. rephrase question (or better yet, post solution to original question)

[This message has been edited by oldmoney (edited January 26, 2000).]
Quote Reply
Re: Fun with default user and force add member profile record... In reply to
Uh...oldmoney...simply using the db_uid as the value for the uid field, the default user will be able to navigate through your database. The if and else conditions you were setting up did not work!

Good...glad you figured it out.

Wink

Regards,


------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------







Quote Reply
Re: Fun with default user and force add member profile record... In reply to
Well, it's certainly possible I've goofed somewhere. Here's what I have in html_home
Code:
$in{$db_key} = $db_userid;
my ($status,@hits) = &query('view');
unless ($status eq 'ok') {
&html_add_form;
return;
}
with this addition in html_add_form
Code:
$in{'add_form'} = 1;
I have a DB search on both my html_home and html_login_form that looks like this (I had to add the if $db_userid statement to get the search to work)...
Code:
print qq|<form action="$db_script_url" method="GET" name="search">
<input type=hidden name="db" value="$db_setup">|;
if ($db_userid eq "") { print qq|<input type=hidden name="uid" value="default">|; }
else { print qq|<input type=hidden name="uid" value="$db_uid">|; }
print qq|<input type=hidden NAME="ma" value="on">
<input type=hidden NAME="mh" value="$db_max_hits">
<input type=hidden NAME="so" value="ascend">
<input type=hidden NAME="view_records" value="Return">
<INPUT TYPE="TEXT" NAME="Userid" SIZE=20>
<INPUT TYPE="SUBMIT" NAME="view_records" VALUE="Go">
</FORM>|;
And then my navigational header looks like this...
Code:
if ($per_view) { print qq|<A HREF="$db_script_link_url">Home</A>|; }
else { print qq|<A HREF="/cgi-bin/gear/memberbot.cgi">Home</A>|; }
With this setup, both a logged in user and the default user can perform a search. The only way back from the search is by clicking home, which tacks on uid=session or uid=default depending on whether the user logged in or not (both have view permissions). However, this triggers the auto-add record code since a default record is not in the DB. Clues on where I went astray?

------------------
The Immuatable Order of Modding
-=-=-=-=-=-=-=-
1. Read the FAQ, 2. Search the board, 2a. Search the board again, 3. ask the question, 4. back-up, 5. experiment, 6. rephrase question (or better yet, post solution to original question)

[This message has been edited by oldmoney (edited January 26, 2000).]