vrana Tue Aug 15 16:17:01 2006 UTC
Modified files:
/phpdoc/en/features http-auth.xml
Log:
Examples indentation
http://cvs.php.net/viewvc.cgi/phpdoc/en/features/http-auth.xml?r1=1.45&r2=1.46&diff_format=u
Index: phpdoc/en/features/http-auth.xml
diff -u phpdoc/en/features/http-auth.xml:1.45
phpdoc/en/features/http-auth.xml:1.46
--- phpdoc/en/features/http-auth.xml:1.45 Mon May 8 23:07:26 2006
+++ phpdoc/en/features/http-auth.xml Tue Aug 15 16:17:01 2006
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.45 $ -->
+<!-- $Revision: 1.46 $ -->
<chapter id="features.http-auth">
<title>HTTP authentication with PHP</title>
@@ -41,15 +41,15 @@
<programlisting role="php">
<![CDATA[
<?php
- if (!isset($_SERVER['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';
exit;
- } else {
+} else {
echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
- }
+}
?>
]]>
</programlisting>
@@ -187,18 +187,18 @@
<programlisting role="php">
<![CDATA[
<?php
- function authenticate() {
+function authenticate() {
header('WWW-Authenticate: Basic realm="Test Authentication System"');
header('HTTP/1.0 401 Unauthorized');
echo "You must enter a valid login ID and password to access this
resource\n";
exit;
- }
+}
- if (!isset($_SERVER['PHP_AUTH_USER']) ||
- ($_POST['SeenBefore'] == 1 && $_POST['OldAuth'] ==
$_SERVER['PHP_AUTH_USER'])) {
- authenticate();
- }
- else {
+if (!isset($_SERVER['PHP_AUTH_USER']) ||
+ ($_POST['SeenBefore'] == 1 && $_POST['OldAuth'] ==
$_SERVER['PHP_AUTH_USER'])) {
+ authenticate();
+}
+else {
echo "<p>Welcome: {$_SERVER['PHP_AUTH_USER']}<br />";
echo "Old: {$_REQUEST['OldAuth']}";
echo "<form action='{$_SERVER['PHP_SELF']}' METHOD='post'>\n";
@@ -206,7 +206,7 @@
echo "<input type='hidden' name='OldAuth'
value='{$_SERVER['PHP_AUTH_USER']}' />\n";
echo "<input type='submit' value='Re Authenticate' />\n";
echo "</form></p>\n";
- }
+}
?>
]]>
</programlisting>