mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Examples indentation
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@218242 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
5fd0e106b0
commit
9641b3c7e3
1 changed files with 12 additions and 12 deletions
|
@ -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 @@ function http_digest_parse($txt)
|
|||
<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 @@ function http_digest_parse($txt)
|
|||
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>
|
||||
|
|
Loading…
Reference in a new issue