Results 1 to 2 of 2

Thread: WWW-Authenticate [resolved]

  1. #1

    Thread Starter
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    WWW-Authenticate [resolved]

    i found this code on my computer, from ages ago, and i cant get it to work? Im running IIS and the variables arent being set?

    PHP Code:
    <?php
      
    if (empty($_SERVER['PHP_AUTH_USER'])) {
        
    header('WWW-Authenticate: Basic realm="My Realm"');
        
    header('HTTP/1.0 401 Unauthorized');
        echo 
    'Text to send if user hits Cancel button';
        exit;
      } else {
        echo 
    "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
        echo 
    "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
      }
    ?>
    Thanks
    Last edited by john tindell; Apr 13th, 2004 at 01:22 PM.

  2. #2

    Thread Starter
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099
    woops foudn out that it only works on apache.

    'PHP_AUTH_USER'

    When running under Apache as module doing HTTP authentication this variable is set to the username provided by the user.
    'PHP_AUTH_PW'

    When running under Apache as module doing HTTP authentication this variable is set to the password provided by the user.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width