DES to MD5 password compare script

From: Date: Tue, 05 Sep 2000 20:30:57 +0000
Subject: DES to MD5 password compare script
Groups: php.general 
Request: Send a blank email to php-general+get-15379@lists.php.net to get a copy of this message
Hi, I wrote the following script which compares a login password with what is stored in a database. Now I am trying to run it on a server which uses MD5 instead of DES. What needs to be changed in order for it to work on this new box? (went from linux to freebsd basically.) Any help is greatly appreciated. I am obviously more familiar with DES than MD5. Please help! :) Kris -(code below)- else{ $data=pg_fetch_object($result, $row); $realpass=$data->password; $passlen=strlen($realpass); $seed=substr($realpass, 0, 2); $pass=substr($realpass, 2, $passlen); $loginpass=crypt($PHP_AUTH_PW, $seed); $comparelen=strlen($loginpass); $comparepass=substr($loginpass, 2, $comparelen); if($comparepass != $pass){ Header("WWW-Authenticate: Basic realm=\"PHLINK ADMIN\""); Header("HTTP/1.0 401 Unauthorized"); $success=0; } else{$success=1;} }

« previous php.general (#15379) next »