<?php
// $Id: securesite.module,v 1.00 2005/4/15 12:43:23 stefan Exp $
/**
* @file
* This module allows admins to use the HTTP Auth
* method of login instead or in conjunction with
* Drupal's built-in login form system.
*/
function securesite_help($section) {
switch ($section) {
case 'admin/modules#description':
return t('Controls the use of HTTP auth with-in Drupal.');
break;
}
}
function securesite_settings() {
$output = form_checkbox(t('Use HTTP Auth'), 'securesite_use_auth',
1, variable_get('example_b', 0),
t('Allow only users access to the site via HTTP Auth.'));
return $output;
}
function securesite_menu($may_cache = NULL) {
if(!isset($_SERVER['PHP_AUTH_USER']) && !$user->uid) {
drupal_set_header('WWW-Authenticate: Basic realm="bound_drupal"');
}
else {
if (isset($_SERVER['PHP_AUTH_PW'])) {
if (!user_authenticate($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW'])) {
drupal_set_header('Location: ' . $securesite);
}
}
}
?>