Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    using php authentication box

    The following:

    header( 'WWW-Authenticate: Basic realm="Private"' );
    header( 'HTTP/1.0 401 Unauthorized' );
    echo 'Authorization Required.';
    exit;

    seems not to set the $PHP_AUTH_USER and $PHP_AUTH_PW globals why can that be?

    thanks

  • #2
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try using:

    $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW']

    as your server may not have registered the global variables... I have however in some cases had problems using this on certain server setups, so I generally try (where possible) to use my own login system using HTML forms (that way I know theres not going to be any problems.

    Some useful information: http://www.php.net/manual/en/features.http-auth.php


  •  

    Posting Permissions

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