Results 1 to 2 of 2
  1. #1

    401 authorisation

    Why doesnt this work for me! I copied it off the net somewhere, eventually want to check the user password in a database. Running on apache server, it seems like the PHP_AUTH_USER is never set. Is it to do with php or my apache config.

    if(!isset($PHP_AUTH_USER)) {
    Header("WWW-Authenticate: Basic realm=\"My Realm\"");
    Header("HTTP/1.0 401 Unauthorized");
    echo "Something not right\n";
    } else {
    echo "Hello $PHP_AUTH_USER.<P>";
    echo "You entered $PHP_AUTH_PW as your password.<P>";

    Thanks, chris.

  2. #2
    Using $_SERVER['PHP_AUTH_USER'] instead works a treat.

Posting Permissions

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