401 Authorization Variables Not Showing Up

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • -Oz-
    Senior Member
    • Mar 2004
    • 545

    #1

    401 Authorization Variables Not Showing Up

    I'm trying to use HTTP 401 authorization variables and it doesn't seem to set the $_SERVER['PHP_AUTH_PW'] or $_SERVER['PHP_AUTH_USER'] variable.

    Anyone have any ideas or would be willing to test whether this works on their server? Here is the code i'm using for authorizing a user and I've seen it work on another server:
    PHP Code:
       if ((!isset($_SERVER['PHP_AUTH_USER'])) || (!isset($_SERVER['PHP_AUTH_PW'])) || ($_SERVER['PHP_AUTH_USER'] != $user['name']) || ($_SERVER['PHP_AUTH_PW'] != $user['password'])) {
          
    header('WWW-Authenticate: Basic realm="HostAuctionImages Login"');
          
    header('HTTP/1.0 401 Unauthorized');
          echo 
    "You must enter a valid login ID and password to access this resource\n";
          exit;
        }
        else {
          return 
    true;
        } 
    Any help of anyone willing to see if it works on their server would be greatly appreciated.
    Dan Blomberg
  • Buddha
    Senior Member
    • Mar 2004
    • 825

    #2
    PHP (suexec) is running as a CGI so those variables probably aren't available.
    "Whatcha mean I shouldn't be rude to my clients?! If you want polite then there will be a substantial fee increase." - Buddha

    Comment

    • -Oz-
      Senior Member
      • Mar 2004
      • 545

      #3
      Hadn't thought of that, remind me again why we use phpsuexec?

      Guess i'll have to go back to the old way.
      Dan Blomberg

      Comment

      Working...