How to Join Member's Area Private Library Search Today's Topics p Login
Main Forums Discussion Tech Talk Mature Content Archives
   Nav Win
 Tech Talk
 Beyond the Basics
 Some help on a confirmation loop?
 1 2 3
Follow us on Facebook

 Moderated by: Ron   (Admins )

 
User Options
Format for Better Printing EMail to a Friend Not Available
Admin Print Send ECard
Passions in Poetry

Some help on a confirmation loop?

 Post A Reply Post New Topic   Go to the Next Oldest/Previous Topic Return to Topic Page Go to the Next Newest Topic 
Christopher
Moderator
Member Rara Avis
since 08-02-99
Posts 9130
Purgatorial Incarceration


0 posted 02-02-2004 11:08 PM       View Profile for Christopher   Email Christopher   Edit/Delete Message      Find Poems  View IP for Christopher

http://egowhores.com/linkage/  - leads to a simple form with a simple user name / password login script (look familiar Ron?) Username: "Cristi" / Password: "cristi".

It passes the info ("userName" & "password") to http://egowhores.com/cgi-bin/pl/plink.pl  and tries to verify the password as being correct.

To all appearances, it checks them and matches them... but it doesn't? I am completely lost here, a little help would be muchly appreciated.

The applicable snippet of code:

if ($action eq "login") {

        #Verify Username and Password
        open (HANDLE, "<db/users.db") || die "Can't open db/users.db: $!\n\n";
        @index = <HANDLE>;
        close (HANDLE);
        foreach $line (@index) {
                ($usrNm, $pwd) = split(/\|/, $line);
                if ($usrNm eq $userName) {
                        chomp($pwd);
                        last;
                        }
                }#End foreach

        if ($pwd eq $password) { header(); print qq~yep~; }
        else { header(); print qq~nope, didn't work<br>$userName<br>$password<br>$usrNm<br>$pwd~;         }

}#End elsif action = login clause.
Ron
Administrator
Member Rara Avis
since 05-19-99
Posts 9708
Michigan, US


1 posted 02-02-2004 11:38 PM       View Profile for Ron   Email Ron   Edit/Delete Message      Find Poems   Click to visit Ron's Home Page   View IP for Ron

I don't see anything wrong with the code itself, Chris.

The output, however, includes a newline that the code above didn't print (\n after $pwd is printed). That suggests that either your chomp isn't being executed or your data file is double-spaced.

Unless you have a really huge database, I would send the header() at the top of the code, then do a print $line through each iteration of the loop. Another thing to try is a regex instead of the chomp; i.e. $line =~ s/\n/!/g; will transform all newlines into bangs so you can see them. Or examine the data in a hex editor?

Without seeing your data, that's about the best I can figure.
Ron
Administrator
Member Rara Avis
since 05-19-99
Posts 9708
Michigan, US


2 posted 02-02-2004 11:45 PM       View Profile for Ron   Email Ron   Edit/Delete Message      Find Poems   Click to visit Ron's Home Page   View IP for Ron

Reading that again, I don't think I was very clear. Approaching the tail-end of a long day.

Your second conditional (if $pwd eq $password) is probably failing because your first conditional (if  usrNm eq $userName) failed and the chomp didn't get executed. OR one chomp isn't enough because the data is double-spaced.
Christopher
Moderator
Member Rara Avis
since 08-02-99
Posts 9130
Purgatorial Incarceration


3 posted 02-02-2004 11:57 PM       View Profile for Christopher   Email Christopher   Edit/Delete Message      Find Poems  View IP for Christopher

I don't for the life of me understand it... but moving header(); to the top worked.

Uhm - to repeat myself... I don't understand it.

Thanks Ron. Amazing how it always seems to be a really easy thing.
 
 Post A Reply Post New Topic   Go to the Next Oldest/Previous Topic Return to Topic Page Go to the Next Newest Topic 
All times are ET (US) Top
  User Options
>> Tech Talk >> Beyond the Basics >> Some help on a confirmation loop? Format for Better Printing EMail to a Friend Not Available
Print Send ECard

 

pipTalk Home Page | Main Poetry Forums

How to Join | Member's Area / Help | Private Library | Search | Contact Us | Today's Topics | Login
Discussion | Tech Talk | Archives | Sanctuary



© Passions in Poetry and netpoets.com 1998-2013
All Poetry and Prose is copyrighted by the individual authors