PerlIsGood
Programmer
Here's an excerpt of the script:
So if a user file has the passwd abc123, and the user enters abc123 into the form field, the script dumps into the $err_sub routine for 'Password Invalid'. I printed the values for debugging and they're the same. What am I missing?
(I tried using != just to see what happens, but that has a bad habit of letting incorrect passwds through...I also tried tossing an extra chomp around $query{'pass'} and $user{'pass'} without luck.) Notorious P.I.G.
Code:
use strict;
use CGI;
my $q = new CGI;
my %query = $q->Vars();
my $userdir = "./ns_forum/profiles";
if ( -e "$userdir/$query{'user'}.dat" )
{
open USR, "$userdir/$query{'user'}.dat" ||
&err_sub('Error', "Failed to open user file: $!");
chomp ( my @user_file = <USR> );
close USR;
foreach ( @user_file )
{
my ( $key, $value ) = split /\|/;
$user{$key} = $value;
}
if ( $user{'pass'} ne $query{'pass'} )
{
&err_sub('Error', 'Password invalid.',
"\$query{'pass'}=$query{'pass'}",
"\$user{'pass'}=$user{'pass'}");
#the added strings passed to sub for debugging
}
} else {
&err_sub('Error', "Complain 'cause it's fun: $!");
}
So if a user file has the passwd abc123, and the user enters abc123 into the form field, the script dumps into the $err_sub routine for 'Password Invalid'. I printed the values for debugging and they're the same. What am I missing?
(I tried using != just to see what happens, but that has a bad habit of letting incorrect passwds through...I also tried tossing an extra chomp around $query{'pass'} and $user{'pass'} without luck.) Notorious P.I.G.