2 function login($inuser, $inpass = NULL)
4 if (empty($inuser)) return;
6 @list ($inuser, $inauth) = explode(':', $inuser, 2);
9 # find password data by user name
10 $pwfile = sprintf('login/%s/.passwd', strtolower($inuser));
11 if (!file_exists($pwfile)) return;
12 $usertest = trim(file_get_contents($pwfile));
13 if (!$usertest) return;
16 $authhash = md5($usertest);
18 if (!password_verify($inpass, $usertest)) return;
21 if ($inauth !== $authhash) return;
24 if (function_exists('apache_note')) apache_note('user', $inuser);
28 'admin' => !empty($inuser) && strtolower($inuser) != 'lid',
29 'auth' => "$inuser:$authhash",
33 if (isset($_COOKIE['login'])) {
35 $User = login($_COOKIE['login']);