- $pwdata = file_get_contents(__DIR__.'/.htpasswd');
- $pwlist = [];
- foreach (explode("\n", $pwdata) as $line) {
- if (!$line) continue;
- list ($username, $pass) = explode(':', $line);
- $pwlist[$username] = $pass;
+function login_setcookie()
+{
+ global $User;
+ return setcookie('login', $User['auth'], 0, '/');
+}
+
+function login($inuser, $inpass = NULL)
+{
+ if (empty($inuser)) return;
+ if (!isset($inpass)) {
+ @list ($inuser, $inauth) = explode(':', $inuser, 2);