Gossamer Forum
Home : Products : DBMan : Customization :

Adding record kicks me to login screen

Quote Reply
Adding record kicks me to login screen
Not sure what the heck is going on, but everytime I try to add a record now (installed/removed Limit One Record Mod and installed/removed Count Category Mod) it kicks me back to the login screen and you dont realize the record is not added until you log back in.

FYI: When user logs in, they are kicked to another sub routine.

Any help would be much appreciated

Theri


Quote Reply
Re: Adding record kicks me to login screen In reply to
I'm confused, you are saying you have installed and removed a few mods. Was everything working prior to adding these mods?

When you removed the mods, did you change back everything that was modified as a result of installing the mod?

There are various limit record mods, so I'm not sure which one you are using.

I think it might be necessary to post a copy of your files. But you should first go through the steps again to be sure you have changed everthing back to the original state before installing the mods you removed.

It's always a good idea to use a backup copy when installing mods so that if something goes wrong you can easily start over or know at what point something stopped working.

The only time I had something similiar happen was when I was testing out different permissions.

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Adding record kicks me to login screen In reply to
Hi Lois.

The mods I installed (script was working fine) was the Category Count mod and the Limit Record To One. Thankfully I made backups, so everything is back to normal, except when I go to add a record it automatically kicks me back to the main page (script_url) which is the login screen. I log back in, and sure as heck I have to go through it again.

I'll post my .cft, html.pl and .cgi files for you in
http://www.coastcottages.com/book
Filenames are bookalesson.txt , default.txt and html.txt

Danke
Theri


PS.... everything seems to work fine, except when I log in and goto add a record. Which brings me to my next question which I'll save for a post. Oh what the heck :)

In my .cgi file in sub main.... there are these lines (I found one of your posts)

elsif ((keys(%in) <= 2) ||
($in{'login'})) { &html_home; }
else { &html_unknown_action; }

Here is what I want to do. I created a sub html_welcome routine in my html.pl (same purpose as sub html_home).

If USER logs in: goto sub html_welcome
If DEFAULT user: goto sub html_home

I have it modified for each specific user. Now I can get it working for only one sub at a time, but when I try to toss in a (unless $db_userid eq default it goes CRASH.

Any suggestions?

Thanks agian Theri
Quote Reply
Re: Adding record kicks me to login screen In reply to
If you want users to login and go to a certain page you have to change the line from:

elsif ((keys(%in) <= 2) ||
($in{'login'})) { &html_home; }

to:

elsif ((keys(%in) <= 2) ||
($in{'login'})) { &html_welcome; }

For the problem of it crashing when you add this line:

(unless $db_userid
eq default)

It is because it must be:

unless ($db_userid eq "default")

There must be "".

Hope this helps.

Julian
Quote Reply
Re: Adding record kicks me to login screen In reply to
Hey Vampy, thanks for the reply. Just to make sure I have my eggs in the right basket, I want to double check before I go ahead and do it. Here is the existing code in question:

elsif ((keys(%in) <= 2) ||
($in{'login'})) { &html_home; }
else { &html_unkown_action; }


What I can do is this:

elsif ((keys(%in) <= 2) ||
($in{'login'}) { unless ($db_userid eq "default") { &html_welcome; } else { &html_home; } }
else { &html_unkown_action; }


I want to make sure default user does not see the default message. I have sub html_home and sub html_welcome. It does not matter to me, but one of those will be for USERS and the other for default user. I just want to ensure a differnet welcoming text and options.

Let me know if that new code will work.

Thanks ole Vampy Guru.

Theri


Quote Reply
Re: Adding record kicks me to login screen In reply to
I should think it will work. But everytime I see "unless" I get a headache. I would prefer to use "if"

If I were doing it, I woudl use:

if ($db_userid eq "default") {&html_home;}
else {&html_welcome;}

there should not be any difference but it's just a matter of preference. BTW, I do not consider myself a GURU. I'm not a GURU in anything. Just an average guy, doing avaerage things. :)

Julian
Quote Reply
Re: Adding record kicks me to login screen In reply to
elsif ((keys(%in) <= 2) ||
($in{'login'}) { if ($db_userid eq "default") { &html_home; } else { &html_welcome;) }
else { &html_unkown_action; }

Is there something I'm miscoding up top here???

#*&$#*& me off.

Quote Reply
Re: Adding record kicks me to login screen In reply to
elsif ((keys(%in) <= 2) ||
($in{'login'})) { if ($db_userid eq "default") { &html_home; } else { &html_welcome;} }
else { &html_unkown_action;}

} should be there instead of curly brackets and missing ) in red.

You were missing the ) in red and the }

Julian
Quote Reply
Re: Adding record kicks me to login screen In reply to
Okay I think I have it.....Jeepers Creepers (no pun intended Vampy) Here is what I tried in the meantime.

elsif ($in{'login'}) { if ($db_userid eq "default") { &html_home; } else { &html_welcome; } }
else { &html_home; }


However I see some flaws in it(it is working for some reason) and I'm going to try to take your code and cross my fingers. I'll get back on this miserable display of coding on my part.

Thanks
Theri




One more thing....I used the EASY LIMIT TO ONE RECORD mod.

# The easiest way to guarantee that each user will have only one
# record in the database is to set the
# $db_key
# to the name of your userid field. You also must set
# $db_key_track = 0;
#
# If the user tries to add a second record, he will get a message
# "duplicate key error"


How does one go and remove / use the ID field now? It will not autogenerate the record? Do I just remove this now from the dbase entirely?

Thanks