@list ($inuser, $inauth) = explode(':', $inuser, 2);
}
- # create pwlist table from htpasswd
- $pwdata = file_get_contents('./.htpasswd');
- $pwlist = [];
- foreach (explode("\n", $pwdata) as $line) {
- if (!$line) continue;
- list ($username, $pass) = explode(':', $line);
- $pwlist[$username] = $pass;
- }
-
- # find user by name
- $usertest = @$pwlist[ strtolower($inuser) ];
+ # find password data by user name
+ $pwfile = sprintf('login/%s/.passwd', strtolower($inuser));
+ if (!file_exists($pwfile)) return;
+ $usertest = trim(file_get_contents($pwfile));
if (!$usertest) return;
# verify password