Header and Authentification

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • maxx

    Header and Authentification

    Hi,

    I want use the header authentificatio n (HTTP/PHP module), and i've a
    big problem for to get the varaibles 'PHP_AUTH-*".

    This is my source code :
    ---------------------------------------------------------------------------------
    <?php
    function authentificate( ) {
    header('WWW-Authenticate: Basic realm="My Realm"');
    header('HTTP/1.0 401 Unauthorized');
    echo 'Texte utilisé si le visiteur utilise le bouton
    d\'annulation';
    exit;
    }

    include("ffrs_m ysql-2.inc.php");
    $sql = new MyDB();

    $userauth =
    $sql->getAuthUser($_ SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']);

    if ($userauth == ($_SERVER['PHP_AUTH_USER'])) ##
    Don't work
    (or if ("maxx" == ($_SERVER['PHP_AUTH_USER'])) ##
    Work)
    {
    echo "c bon";
    include("adduse rAdminForm.php" );
    print_r ($_SERVER);
    }
    else
    {
    authentificate( );
    }
    ?>
    ---------------------------------------------------------------------------------


    The window popup authentificatio n don't open and i am going directly on
    my page. When i replace "$userauth" by "maxx" for example, the window
    popup authentificatio n open with no problem and i can login myself.

Working...