diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-10-27 07:43:02 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-10-27 07:43:02 +0000 |
commit | e0fa17f8cc0138a166b08168a54632cd8c806a1a (patch) | |
tree | 035b7c7e6a1d6d661e70e2100a26ff16057ca2ab /lib | |
parent | d6e50fd701008d2b8cfa5ecb827ae0880c91b500 (diff) | |
download | ampache-e0fa17f8cc0138a166b08168a54632cd8c806a1a.tar.gz ampache-e0fa17f8cc0138a166b08168a54632cd8c806a1a.tar.bz2 ampache-e0fa17f8cc0138a166b08168a54632cd8c806a1a.zip |
new http auth method
Diffstat (limited to 'lib')
-rw-r--r-- | lib/class/user.class.php | 3 | ||||
-rw-r--r-- | lib/init.php | 17 |
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/class/user.class.php b/lib/class/user.class.php index 490a1b88..66eb088e 100644 --- a/lib/class/user.class.php +++ b/lib/class/user.class.php @@ -55,6 +55,9 @@ class User { $this->username = sql_escape($username); $info = $this->_get_info(); + + if (!count($info)) { return false; } + $this->id = $this->username; $this->uid = $info->id; $this->username = $info->username; diff --git a/lib/init.php b/lib/init.php index 81cb8041..d5c6d560 100644 --- a/lib/init.php +++ b/lib/init.php @@ -230,6 +230,23 @@ if (isset($_POST['no_session']) || isset($_GET['no_session'])) { debug_event('no_session','No Session passed as get/post','1'); } +/* We have to check for HTTP Auth */ +if (in_array("http",$results['auth_methods'])) { + + $username = scrub_in($_SERVER['PHP_AUTH_USER']); + $results = vauth_http_auth($username); + + if ($results['success']) { + vauth_session_cookie(); + vauth_session_create($results); + $session_name = vauth_conf('session_name'); + $_SESSION['userdata'] = $results; + $_COOKIE[$session_name] = session_id(); + } + +} // end if http auth + + // If we don't want a session if (!isset($no_session) AND conf('use_auth')) { if (!vauth_check_session()) { logout(); exit(); } |