[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SV: [cobalt-developers] Username -> website



On Mon, Oct 23, 2000 at 11:00:47AM +0200, Anders Flyndersøe wrote:

> > That's it, Adam!
> > SERVER_NAME is what I really need to get all the informations I need: I
> > thought about it too late, because I thought that RaQs had some kind of
> > weird mechanism to associate usernames to their sites.
> > And, obviously, the answer to my question was the easiest! ;-)
> 
> Is it possible to check username & password in a PHP-script???

Of course you can: the vars you need to read are:

PHP_AUTH_USER -> username
PHP_AUTH_PW   -> password
SERVER_NAME   -> name of the server.

In php manual there's a good example: I paste it here:

<?php
  if(!isset($PHP_AUTH_USER)) {
    Header("WWW-Authenticate: Basic realm=\"My Realm\"");
    Header("HTTP/1.0 401 Unauthorized");
    echo "Text to send if user hits Cancel button\n";
    exit;
  } else {
    echo "Hello $PHP_AUTH_USER.<P>";
    echo "You entered $PHP_AUTH_PW as your password.<P>";
  }
?>

Bye
Edo