note 62682 rejected from features.http-auth by bjori
| From: | bjori@php.net | Date: | Tue, 07 Mar 2006 13:38:08 +0000 |
| Subject: | note 62682 rejected from features.http-auth by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-104981@lists.php.net to get a copy of this message | ||
Note Submitter: larsgroenberg at gmail dot com
----
How do I repeat getting the WWW-Authentication box up 3 times or until the user give me a username
and password that is in my database... I have no problem the first time but I can't get the
box up the second time....
I am working with the following code:
<?php
include('g_alle.php');
$link = dbConnect();
$login = logPaa();
$username = $_SERVER['PHP_AUTH_USER'];
$password = $_SERVER['PHP_AUTH_PW'];
$userID = auth($username, $password);
if ($userID == -1)
{
$login2 = logpaaIgen();
$username = $_SERVER['PHP_AUTH_USER'];
$password = $_SERVER['PHP_AUTH_PW'];
$userID = auth($username2, $password2);
}
g_alle.php
function logPaa() {
header('WWW-Authenticate: Basic realm="Indtast brugernavn og password"');
header('HTTP/1.0 401 Unauthorized');
exit;
}
function logpaaIgen() {
header('WWW-Authenticate: Basic realm="Indtast brugernavn og password"');
header('HTTP/1.0 401 Unauthorized');
exit;
}