Re: [PHP-LANG] PHP4 & AUTH procedure

[email protected] ("Alexander Gr?f")
Newsgroups php.lang
Message-ID <[email protected]>
It has something to do with register_globals. Try to turn it on in your
php.ini. I tried it myself and found out that this piece of code works:

<?php
  if(!isset($HTTP_SERVER_VARS['PHP_AUTH_USER']))
    {
     Header("WWW-authenticate: Basic realm=\"Acceso restringido\"");
     Header("HTTP/1.1 401 Unauthorized");
     echo "To access you need a pair (name,password), SORRY!!";
     exit;
    }
  else
    {
     echo "ALL OK";
     exit;
    }
?>

When you don't have access to the configuration of php (for example hosted
by a web provider) you can use this.

Hope this was helpfull

--



[email protected]
+49 9721 188848
+49 171 370 97 15
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.