---
title: "$PHP_AUTH osv."
type: "forum-thread"
url: "https://www.webforum.nu/amne/php/16380-php-auth-osv"
topic: "PHP"
topic_url: "https://www.webforum.nu/amne/php"
author: "oelbal"
published: "2001-12-01T17:53:00.000Z"
updated: "2001-12-02T19:42:00.000Z"
replies: 4
views: 156
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/php/16380-php-auth-osv"
---

# $PHP_AUTH osv.

## #1 — oelbal, 2001-12-01T17:53Z

Försökte testa att göra en simpel inloggningsruta idag, men det verkar inte fungera. Mitt Win2K bara loopar rutan hela tiden, den verkar inte vilja acceptera värdena. Vad har jag gjort för fel?

```
<?
if (!isset($PHP_AUTH_USER) &#0124;&#0124; !isset($PHP_AUTH_PW))
{
  header('WWW-Authenticate: Basic realm="Private"');
  header('HTTP/1.0 401 Unauthorized');
  exit;
}
else
{
  echo("Du skrev $PHP_AUTH_USER och $PHP_AUTH_PW");
}
?>
```

Permalänk: https://www.webforum.nu/p/16380

## #2 — cmk, 2001-12-02T11:52Z

I manualen kan man läsa:

> **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.** In an Apache module PHP script, it is possible to use the header() function to send an "Authentication Required" message to the client browser causing it to pop up a Username/Password input window. Once the user has filled in a username and a password, the URL containing the PHP script will be called again with the variables, $PHP_AUTH_USER, $PHP_AUTH_PW and $PHP_AUTH_TYPE set to the user name, password and authentication type respectively. Only "Basic" authentication is supported at this point. See the header() function for more information.

/Marty

Permalänk: https://www.webforum.nu/p/325055

## #3 — oelbal, 2001-12-02T15:11Z

Misstänkte det, men tack iaf!

Permalänk: https://www.webforum.nu/p/325056

## #4 — OlleBoop, 2001-12-02T17:55Z

Har du provat att köra PHP som ISAPI-modul?

Permalänk: https://www.webforum.nu/p/325057

## #5 — oelbal, 2001-12-02T19:42Z

Jag kör PHP om ISAPI-modul nu...

Permalänk: https://www.webforum.nu/p/325058

---

Tråden på webben: https://www.webforum.nu/amne/php/16380-php-auth-osv
