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 $userdir = 'login/'.strtolower($inuser);
11 $pwfile = "$userdir/.passwd";
12 if (!file_exists($pwfile)) return;
13 $usertest = trim(file_get_contents($pwfile));
14 if (!$usertest) return;
17 $authhash = md5($usertest);
19 if (!password_verify($inpass, $usertest)) return;
22 if ($inauth !== $authhash) return;
25 if (function_exists('apache_note')) apache_note('user', $inuser);
29 'admin' => file_exists("$userdir/.admin"),
30 'auth' => "$inuser:$authhash",
34 if (isset($_COOKIE['login'])) {
36 $User = login($_COOKIE['login']);