logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Third-party Modules View previous topic :: View next topic
Reply to topic   Topic: Is there any solution for auth with php scripts or fcgid
Author
cagecn



Joined: 24 Feb 2009
Posts: 1

PostPosted: Tue 24 Feb '09 17:51    Post subject: Is there any solution for auth with php scripts or fcgid Reply with quote

Is there any solution for auth with php scripts or java class
I load fcgid module like this

apache.conf

<Location /c>
SetHandler fcgid-script
Options ExecCGI
allow from all
AuthType Basic
AuthName ProtectedRealm
FastCgiAuthenticator "C:/php-5.2.8/php auth.php"
require valid-user
</Location>

auth.php
<?php

printf("Content-type: text/html\r\n");

printf("Status: 200 Ok\r\n");
?>

I got an error:
Syntax error on line 90 of C:/Apache2.2/conf/extra/httpd-vhosts.conf:
can't get authorizer file info: auth.bat, errno: 720002

any one can help me?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Thu 09 Apr '09 17:37    Post subject: Reply with quote

a very short solution

Code:

<?php

        $admin="admin"; // user
    $psw="secret"; // password
    $nameRestricted="Foo Bar"; // Name of the area
        If(($_SERVER['PHP_AUTH_USER']!=$admin)||($_SERVER['PHP_AUTH_PW']!=$psw)) {
        Header("WWW-Authenticate: Basic realm=\"$nameRestricted\"");
        Header("HTTP/1.0 401 Unauthorized");
        include "acces_forbidden.php";

} else {
?>
<html><head>
......
</body></html>
<?php
}
?>
Back to top


Reply to topic   Topic: Is there any solution for auth with php scripts or fcgid View previous topic :: View next topic
Post new topic   Forum Index -> Third-party Modules