In mod_perl 2:

sub handler {
    my ($r) = shift;

    my ($res, $password) = ($r->get_basic_auth_pw);
    return $res if $res;    #decline if not Basic
    my $username = $r->user;

    if ($username eq '') {
        $r->note_basic_auth_failure;
        $r->log_error ("no account given for uri=<" .  $r->uri . ">");
        return Apache::AUTH_REQUIRED;
    }

# etc...

    return Apache::OK;
}



Kai wrote:
Hi List,
 I am going to write a  HTTP authentication by using mod_perl.And I wrote
some code like the following:
---
#!/usr/bin/perl -w
use CGI;
my $p=new CGI;
print $p->header(-status=>401,
                        -www_authenticate='Basic realm="test area"',
                        -type=>'text/html');
---
 Now,if I open this script,the brower will pop a authenticate box.
 I want to know,how can I get the id and password that the client inputed in
that authenticate box .
 Would someone give any advice ?
 Thanx.

Regards,
Kai




-- Matthew Darwin [EMAIL PROTECTED] http://www.mdarwin.ca

--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Reply via email to