1
0
mirror of https://github.com/php/web-php.git synced 2026-03-30 11:12:09 +02:00
Files
archived-web-php/include/cvs-auth.inc

33 lines
659 B
PHP

<?
/* $Id$ */
$ignore_password = false;
$passwd_file = "/repository/CVSROOT/passwd";
function find_password($user) {
global $passwd_file, $ignore_password;
if ($ignore_password) return " "; // can't be ""
$fp=fopen($passwd_file,"r");
while(!feof($fp)) {
$line=fgets($fp,120);
list($luser,$passwd,$junk) = explode(":",$line);
if($user==$luser) {
fclose($fp);
return($passwd);
}
}
fclose($fp);
return("");
}
function verify_password($user, $pass) {
global $ignore_password;
$psw = find_password($user);
if (strlen($psw) > 0) {
if ($ignore_password || crypt($pass,substr($psw,0,2)) == $psw) {
return true;
}
}
return false;
}