Hey all! I have the following code that is doing *EXACTLY* what I want it to do and I would not have a clue why? LOL. The code was written by myself and I was only experimenting with it and testing it until I realized that it worked exactly how I wanted it to, but it wasn't ment to... :) Can any one give me some pointers on whats going on in the following...
$file = '/etc/passwd'; $user_to_change = 'dan'; $user_to_change =~ s/[^a-zA-Z0-9]//g; $password_new = 'pass'; $cpassword_new = 'pass'; sub password_change { open PASSWD, "$file" or die "Error 111. Cannot open this file. Please contact Vintek: mail\@vintek.net"; while ( $lines = <PASSWD> ) { @lines = split (/:/, $lines); } if ( $lines[0] ne $user_to_change) { print "Sorry you cannot change the details for the user $user_to_change"; } close PASSWD; #} elsif ( $lines[3] == 45 && $lines[0] ne $user ) { # close PASSWD; # wrong_user(); } elsif ( $password_new ne $cpassword_new ){ close PASSWD; print "Sorry the passwords you entered did not match"; } else { close PASSWD; #Do some stuff here that isn't important. print "The password for $user_to_change has been successfully changed!"; } } So basically the above code will open /etc/passwd for reading and I only want the user to be able to change password for users with a GID of 45. Now as mentioned earlier this works fine and the user can only do this but why? :) if ( $lines[0] ne $user_to_change) { print "Sorry you cannot change the details for the user $user_to_change"; } Does it have something to do the above bit of code. Any ideas? Regards, Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]