My sincere thanks to: webmaster at kratia dot com 21-Feb-2007 01:53
The principle is to not allow an invalid PHP_AUTH_USER to exist.
The following easy peasy example using Oracle is based on his simple genius:
///////////////////////////////////////////////////////////////
//
// do_html_header
//
// This function outputs the html header for the page.
//
//////////////////////////////////////////////////////////////////
function initialize_session()
{
$err=error_reporting(0);
$connection=oci_connect($_SERVER['PHP_AUTH_USER'],
$_SERVER['PHP_AUTH_PW'],$databasename) ;
error_reporting($err);
if (!$connection)
{
header('WWW-Authenticate: Basic Realm="ZEIP1"');
header('HTTP/1.0 401 Unauthorized');
echo "Login Cancelled';
exit;
}
..
Normal Code..
..
}
Voting
The Note You're Voting On
Dutchdavey ¶
6 years ago
