Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
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.
| |
|
Topic: Is there any solution for auth with php scripts or fcgid |
|
Author |
|
cagecn
Joined: 24 Feb 2009 Posts: 1
|
Posted: Tue 24 Feb '09 17:51 Post subject: Is there any solution for auth with php scripts or fcgid |
|
|
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
|
Posted: Thu 09 Apr '09 17:37 Post subject: |
|
|
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 |
|
|
|
|
|
|