note 15776 added to function.crypt

From: Date: Tue, 02 Oct 2001 18:57:22 +0000
Subject: note 15776 added to function.crypt
Groups: php.notes 
Request: Send a blank email to php-notes+get-18479@lists.php.net to get a copy of this message
OK. Perhaps this is trivial for long time UNIX gurus, but it took me two years or so to find out how to validate a Solaris shadowed password. It's quite simple: get the first and second characters of the password you want to validate, then feed this as the salt, and what the user is entering as the string, as follows: $salt = "do your own stuff to read /etc/shadow and get the first and second characters of the password"; $pass_cryp = crypt($user_entered_pass, $salt); if ($pass_cryp == $user_entered_pass) echo "Passwords match"; else echo "Get the hell outta here, intruder!"; Hope it helps. Paulo -- http://www.php.net/manual/en/function.crypt.php http://master.php.net/manage/user-notes.php?action=edit+15776 http://master.php.net/manage/user-notes.php?action=delete+15776 http://master.php.net/manage/user-notes.php?action=reject+15776

« previous php.notes (#18479) next »