[PHP-DEV] User authentication in PHP with a CGI version of PHP From: dennis witjas (dennis.witjas <email protected>)
Date: 03/30/00

Hello

I am trying to add users to my restricted site ( I use the wnpasswd file)
with a php script.

I have seen some examples for a apache server but we are hosted on a wn
server with PHP as a CGI. This means that the following code is not working
1
2 <?php
3 if(!isset($PHP_AUTH_USER)) {
4 Header("WWW-Authenticate: Basic realm=\"My Realm\"");
5 Header("HTTP/1.0 401 Unauthorized");
6 echo "Text to send if user hits Cancel button\n";
7 exit;

this text explains this :

The HTTP Authentication hooks in PHP are only available when it is running
as an Apache module and is hence not available in the CGI version.

So is there anyone who can help me with some code that will work on my server?

I can use the folloing to identify the login name of the user :
$REMOTE_USER
but I like to be able to add a new user to the wnpasswd file and also store
the user name and password in MySql database

kind regards
dennis witjas
Holland
dennis <email protected>