>


Authentication



<?php
  function authenticate() {
    header('WWW-Authenticate: Basic realm="Test Authentication System"');
    header('HTTP/1.0 401 Unauthorized');
    echo "You must enter a valid login ID and password to access this resource\n";
    exit;
  }

  if(!isset($HTTP_SERVER_VARS['PHP_AUTH_USER'])) {
   authenticate();
  }
  else {
   echo "

Welcome {$HTTP_SERVER_VARS['PHP_AUTH_USER']}"; } ?>