At 10:33 AM 7/3/02 -0500, Jose Vicente Paredes Loor. wrote:
>Hi, again
>I am looking for help to validate a linux user.
>I mean, the user, writes username and password and the script returns true or
>false if login is correct or incorrect.
>
>Please help me

% perldoc -f crypt
[snip]
              Here's an example that makes sure that whoever runs
              this program knows their own password:

                  $pwd = (getpwuid($<))[1];

                  system "stty -echo";
                  print "Password: ";
                  chomp($word = <STDIN>);
                  print "\n";
                  system "stty echo";

                  if (crypt($word, $pwd) ne $pwd) {
                      die "Sorry...\n";
                  } else {
                      print "ok\n";
                  }


--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com/


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to