Hey Guys, Well im trying to create a change password script. Ive got a password.txt file of which holds the username and passwords eg.
jrojas:jrsWIWyBMGLdM test:teH0wLIpW0gyQ peter:pe9Wcpzwb4XmA
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..
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"); }
Can someone please, please help me!?

In reply to File input not working properly? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.