Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
But within the script i obvioulsy want to check it is that user, so im getting them to input their password, of which it then encrypts to check it against the passwords.txt file.. BUT only the first line of my passwords.txt file is being read by the looks of it.. I can update the user thats on the top of the file, but no others..jrojas:jrsWIWyBMGLdM test:teH0wLIpW0gyQ peter:pe9Wcpzwb4XmA
Can someone please, please help me!?print ("Enter Your Current Password:"); system ("stty -echo"); $inputline3 = <STDIN>; system ("stty echo"); chop ($inputline3); #Encrypt the password $salt = $userName2; $encryptpw2 = crypt ($inputline3,$salt); open my $fh, "<", 'passwords.txt' or die "Can't open password file: $! +"; while (<$fh>) { chomp; ($name,$passwd) = split(/:/); if ($encryptpw2 eq $passwd) { print ("\nEnter Your new password:"); system ("stty -echo"); $newpass = <STDIN>; system ("stty echo"); chop ($newpass); print ("\nPlease enter your new password in again:"); system ("stty -echo"); $newpass2 = <STDIN>; system ("stty echo"); chop ($newpass2); } else { die ("\n\nYour Passwords Did Not Match, Please Try running the + script again. \n\n"); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: File input not working properly?
by hipowls (Curate) on Apr 22, 2008 at 06:38 UTC | |
Re: File input not working properly?
by apl (Monsignor) on Apr 22, 2008 at 09:36 UTC |