Here is a solution I developed for the HTTP AUTHENTICATION on that buggy
Internet Explorer.
I want some feedbacks, improvements, Comments...


Bharath
(B. h.  Loh.)
bharath_b_lohray (at) yahoo.com



Please correspond via email for my convinience and
also on the News Group for the benifit of the Php Developers...


=================== START OF SOURCE CODE [lohauthsol.php]===================
<?php
//Username and password verification function
//takes (username,password) returns TRUE/FALSE
function verify($un,$pw)
{
    //Verify against a database etc....
    if
((($un=="bharath")&&($pw=="password1"))||(($un=="tom_dick_harrypotter")&&($p
w=="password2")))
    {
        $ok=TRUE;
    }
    else
    {
        $ok=FALSE;
    }
    return $ok;
}

//Procedure to display a standard error if login
//fails
function er($err)
{
    echo "<html><head><title>$err</title></head><body bgcolor=\"#FFFFFF\"
text=\"#000000\"><p><font face=\"Courier New, Courier, Terminal\"
size=\"3\"><font size=\"5\">$err</font><br><br>Could not log you in. <a
href=\"lohauthsol.php\">TRY AGAIN</a></font></p></body></html>";
}

//Procedure to ask username and password by
//HTTP AUTHENTICATION
function ask()
{
    header("WWW-Authenticate: Basic realm=\"1024x1024.net
Administration\"");
    header("HTTP/1.0 401");
    er("Unauthorized");
    exit;
}

//BEGIN MAIN PROGRAMME
if ((!isset($PHP_AUTH_USER))||(!verify($PHP_AUTH_USER,$PHP_AUTH_PW)))
{
    ask();
}
else
{
    echo "OK";
    exit;
}
?>
=================== END OF SOURCE CODE ===================



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to