downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

Voting

Please answer this simple SPAM challenge: min(eight, seven)?
(Example: nine)

The Note You're Voting On

Dutchdavey
6 years ago
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..
   ..
}

<< Back to user notes page

 
show source | credits | stats | sitemap | contact | advertising | mirror sites