mfischer Mon Jun 10 19:02:35 2002 EDT Modified files: /phpdoc/en/features http-auth.xml /phpdoc/en/appendices reserved.xml predefined.xml Log: - Document the *AUTH* vars in the predefined appendix, use $_SERVER and $_REQUEST in the http auth example, closes #14804. # Wth has there been used !strcmp() to match strigns?! Removed. Index: phpdoc/en/features/http-auth.xml diff -u phpdoc/en/features/http-auth.xml:1.22 phpdoc/en/features/http-auth.xml:1.23 --- phpdoc/en/features/http-auth.xml:1.22 Sat May 11 16:29:49 2002 +++ phpdoc/en/features/http-auth.xml Mon Jun 10 19:02:32 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.22 $ --> +<!-- $Revision: 1.23 $ --> <chapter id="features.http-auth"> <title>HTTP authentication with PHP</title> @@ -25,14 +25,14 @@ <programlisting role="php"> <![CDATA[ <?php - if (!isset($PHP_AUTH_USER)) { + if (!isset($_SERVER['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 "<p>Hello $PHP_AUTH_USER.</p>"; - echo "<p>You entered $PHP_AUTH_PW as your password.</p>"; + echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>"; + echo "<p>You entered {$_SERVER['$PHP_AUTH_PW']} as your password.</p>"; } ?> ]]> @@ -104,15 +104,15 @@ exit; } - if (!isset($PHP_AUTH_USER) || ($SeenBefore == 1 && !strcmp($OldAuth, $PHP_AUTH_USER))) { + if (!isset($_SERVER['PHP_AUTH_USER']) || ($SeenBefore == 1 && $OldAuth == +$_SERVER['$PHP_AUTH_USER']))) { authenticate(); } else { - echo "<p>Welcome: $PHP_AUTH_USER<br>"; - echo "Old: $OldAuth"; - echo "<form action='$PHP_SELF' METHOD='POST'>\n"; + echo "<p>Welcome: {$_SERVER['$PHP_AUTH_USER']}<br>"; + echo "Old: {$_REQUEST['$OldAuth']}"; + echo "<form action='{$_SERVER['$PHP_SELF']}' METHOD='POST'>\n"; echo "<input type='hidden' name='SeenBefore' value='1'>\n"; - echo "<input type='hidden' name='OldAuth' value='$PHP_AUTH_USER'>\n"; + echo "<input type='hidden' name='OldAuth' value='{$_SERVER['$PHP_AUTH_USER']}'>\n"; echo "<input type='submit' value='Re Authenticate'>\n"; echo "</form></p>\n"; } Index: phpdoc/en/appendices/reserved.xml diff -u phpdoc/en/appendices/reserved.xml:1.21 phpdoc/en/appendices/reserved.xml:1.22 --- phpdoc/en/appendices/reserved.xml:1.21 Fri May 17 13:32:24 2002 +++ phpdoc/en/appendices/reserved.xml Mon Jun 10 19:02:33 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.21 $ --> +<!-- $Revision: 1.22 $ --> <appendix id="reserved"> <title>List of Reserved Words</title> @@ -551,6 +551,36 @@ <simpara> The URI which was given in order to access this page; for instance, '<literal>/index.html</literal>'. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>PHP_AUTH_USER</varname>'</term> + <listitem> + <simpara> + When running under Apache as module doing HTTP authentication this + variable is set to the username prodived by the user. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>PHP_AUTH_PW</varname>'</term> + <listitem> + <simpara> + When running under Apache as module doing HTTP authentication this + variable is set to the password prodived by the user. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>PHP_AUTH_TYPE</varname>'</term> + <listitem> + <simpara> + When running under Apache as module doing HTTP authenticated this + variable is set to the authentication type. </simpara> </listitem> </varlistentry> Index: phpdoc/en/appendices/predefined.xml diff -u phpdoc/en/appendices/predefined.xml:1.9 phpdoc/en/appendices/predefined.xml:1.10 --- phpdoc/en/appendices/predefined.xml:1.9 Mon May 27 07:31:07 2002 +++ phpdoc/en/appendices/predefined.xml Mon Jun 10 19:02:34 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.9 $ --> +<!-- $Revision: 1.10 $ --> <!-- Note: Please do not link or translate this file yet. This is only an initial update, quite a few more commits will @@ -353,6 +353,36 @@ The filename of the currently executing script, relative to the document root. If PHP is running as a command-line processor, this variable is not available. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>PHP_AUTH_USER</varname>'</term> + <listitem> + <simpara> + When running under Apache as module doing HTTP authentication this + variable is set to the username prodived by the user. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>PHP_AUTH_PW</varname>'</term> + <listitem> + <simpara> + When running under Apache as module doing HTTP authentication this + variable is set to the password prodived by the user. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>PHP_AUTH_TYPE</varname>'</term> + <listitem> + <simpara> + When running under Apache as module doing HTTP authenticated this + variable is set to the authentication type. </simpara> </listitem> </varlistentry>