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"); } }
In reply to working with foreach, nestd if's inside by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |