[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Status & CVS & objects



On Thu, Nov 04, 1999 at 06:10:44PM -0500, Jason Pincin wrote:
> What I don't understand - is HOW PHP IS GOING TO SET THE PROPER HTTP AUTH
> FLAGS OR whatever in the browser.  ?????  Am I missing something really

You send the browser a 'WWW-Authenticate: Basic realm="OurRealm"' header for
every page you want authorized and the browser automatically handles it and
sends you back a string you need to parse.

<?php
  if(!isset($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\n";
    exit;
  } else {
    echo "Hello $PHP_AUTH_USER.<P>";
    echo "You entered $PHP_AUTH_PW as your password.<P>";
  }
?>

Which I shamelessy ripped from the PHP user's guide, which has a section on
this issue (Chapter 16 under Features).

-- 
-------------------
Daniel E. Markle
syntax@ashtech.net
http://www.ashtech.net/syntax
-------------------