Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Ok Now in this partif($q->param('do') eq "Login") { open(USER, "user.dat"); @user = <USER>; close(USER); if(!$q->param('user')) { &error("You need to enter a username"); } elsif(!$q->param('pass')) { &error("You need to enter a password"); } else { foreach $line (@user) { chomp($line); ($name, $site, $site_id, $des, $email, $pass) = split(/\|/,$ +line); $pass2 = crypt($q->param('pass'), r); if($q->param('user') eq $site_id) { if($pass2 eq $pass) { &start; } else { &error("Password or Username is Incorrect"); } } } } }
How can I say "if($q->param('user') ne $site_id)" it's in a foreach loop, if I do something else it will print it like 20 times.if($q->param('user') eq $site_id) { if($pass2 eq $pass) { &start; } else { &error("Password or Username is Incorrect"); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: working with foreach, nestd if's inside
by VSarkiss (Monsignor) on Jun 11, 2002 at 23:28 UTC | |
|
Re: working with foreach, nestd if's inside
by thunders (Priest) on Jun 11, 2002 at 23:41 UTC | |
by Anonymous Monk on Jun 12, 2002 at 04:24 UTC |