2 // Provides HTTP Basic authentication of a user, and sets two variables, sId and username,
3 // with the user's info.
5 function authenticate() {
6 header('WWW-Authenticate: Basic realm="del.icio.us API"');
7 header('HTTP/1.0 401 Unauthorized');
8 die("Use of the API calls requires authentication.");
11 if (!isset($_SERVER['PHP_AUTH_USER'])) {
14 require_once('../header.inc.php');
15 $userservice =& ServiceFactory::getServiceInstance('UserService');
17 $login = $userservice->login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);