cvs: peardoc /ja/package/authentication/auth intro.xml /ja/package/authentication/auth/auth auth.xml getauth.xml getstatus.xml setexpire.xml
setsessionname.xml start.xml

From: Date: Sat, 01 Nov 2003 13:54:12 +0000
Subject: cvs: peardoc /ja/package/authentication/auth intro.xml /ja/package/authentication/auth/auth auth.xml getauth.xml getstatus.xml setexpire.xml
setsessionname.xml start.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-1856@lists.php.net to get a copy of this message
elf Sat Nov 1 08:54:12 2003 EDT Added files: /peardoc/ja/package/authentication/auth intro.xml /peardoc/ja/package/authentication/auth/auth auth.xml getauth.xml getstatus.xml setexpire.xml setsessionname.xml start.xml Log: o added japanese manual.

Index: peardoc/ja/package/authentication/auth/intro.xml +++ peardoc/ja/package/authentication/auth/intro.xml <!-- $Revision: 1.1 $ --> <!-- Sync: 1.7 --> <refentry id="package.authentication.auth.intro"> <refnamediv> <refname>導入</refname> <refpurpose>使用例</refpurpose> </refnamediv> <refsect1 id="packages.authentication.auth.intro.example"> <title>認証チュートリアル</title> <simpara> この"簡易チュートリアル"の目的は、 簡単に使える認証機構によりセキュアなサイトを構築するシステムを 設定することです。 </simpara> <para> セキュアとするサイトの最上位に、以下の短いコードを置いてみましょう。 </para> <example> <title><classname>PEAR::Auth</classname>の典型的な使用例</title> <programlisting role="php"> <![CDATA[ require_once "Auth/Auth.php"; function loginFunction() { /** * Change the HTML output so that it fits to your * application. */ echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">"; echo "<input type=\"text\" name=\"username\">"; echo "<input type=\"password\" name=\"password\">"; echo "<input type=\"submit\">"; echo "</form>"; } $dsn = "mysql://user:password@localhost/database"; $a = new Auth("DB", $dsn, "loginFunction"); $a->start(); if ($a->getAuth()) { /** * The output of your site goes here. */ } ]]> </programlisting> <para> この短いコードは、認証システムのインスタンスを作成するものです。 </para> <para> 最初の行では、PEARディレクトリからファイルを読み込んでいます。 The first line in the above script includes the file from your PEAR directory. ここには、PEAR::Authを実行する際に必要なコードが全て含まれています。 It contains all the necessary code to run <classname>PEAR::Auth</classname>. この後、ログイン画面を表示する関数を1つ定義します。 この関数は、 このページを閲覧する者がログインデータを入力するために使用されます。 この関数の <acronym>HTML</acronym> フォーマットは自由に変更することが出来ます。 </para> <para> <warning> <simpara> この関数のHTMLフォーマットは自由に変更できますが、 inputボックスのnameは変更してはいけません。 それらは <literal>username</literal>および<literal>password</literal> とする必要があります。 </simpara> </warning> </para> <para> ログインデータを検証するためにデータベースを使用するため、 ここで、変数<varname>$dsn</varname>を作成します。 この変数には、 <link linkend="package.database.db">PEAR::DB</link> によりデータベースと接続する際に使用される有効なDSN文字列を指定します。 その他のストレージコンテナを使用したい場合は、 後述する詳細な説明を参照下さい。 </para> <para> After that we create the authentication object. The first parameter defines the name of the storage container. Because we want to use a database driven storage container, we pass "DB" here. The second parameter is the connection parameter for the container driver. We use the previously defined DSN string. The third parameter is the name of our function that we defined at the beginning of the script. It prints the login form. </para> <para> Now our authentication object is initialized and we need to check if the user is logged in. This is done via the method <function>getAuth</function>. If it returns &true;, we can pass the content of our page to the user. </para> <para> <warning> <para> For now one cannot use <programlisting role="php"> <![CDATA[ $auth = new Auth(...); ]]> </programlisting> with <literal>register_globals=on</literal>, because <varname>$auth</varname> is also the name of the session variable, that is internally used by <classname>PEAR::Auth</classname>. </para> </warning> </para> </example> <example> <title>Using optional authentication</title> <programlisting role="php"> <![CDATA[ require_once "Auth/Auth.php"; function loginFunction() { /** * Change the HTML output so that it fits to your * application. */ echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "?login=1\">"; echo "<input type=\"text\" name=\"username\">"; echo "<input type=\"password\" name=\"password\">"; echo "<input type=\"submit\">"; echo "</form>"; } if (isset($_GET['login']) && $_GET['login'] == 1) { $optional = true; } else { $optional = false; } $dsn = "mysql://user:password@localhost/database"; $a = new Auth("DB", $dsn, "loginFunction", $optional); $a->start(); echo "Everybody can see this text!<br />"; if (!isset($_GET['login'])) { echo "<a href=\"test.php?login=1\">Click here to log in</a>\n"; } if ($a->getAuth()) { echo "One can only see this if he is logged in!"; } ]]> </programlisting> <para> This is a pretty nice example for the optional login feature: The last parameter <parameter>$optional</parameter> can be either &true; or &false;. If it is &false;, the login form is not shown and the user only sees the text "Everybody can see this text!". If he clicks on the link above this text, he gets the same page but with the GET parameter "login=1". Now he can enter his login information in the login form. If he successfully logs in, he can then see the text "Everybody can see this text!" and the text "One can only see this if he is logged in!". </para> </example> <example> <title>Logout functionality</title> <simpara> The following example performs a <quote>logout</quote> for the current user and displays the login form again. </simpara> <programlisting role="php"> $myauth->start(); if ($_GET['action'] == "logout") { $myauth->logout(); $myauth->start(); } </programlisting> </example> <para> In the following passages we cover more detailed information about the functions of <classname>PEAR::Auth</classname>. </para> <para> This SQL statement creates a table usable under the default database authentication scheme using MySQL: </para> <programlisting role="sql"> <![CDATA[ CREATE TABLE auth ( username VARCHAR(50) default '' NOT NULL, password VARCHAR(32) default '' NOT NULL, PRIMARY KEY (username), KEY (password) ); ]]> </programlisting> <para> These are the table and field names necessary for working authentication. The password column must be at least 32 characters long because we store passwords encrypted using md5() and that is the length of the values returned by md5(). </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: peardoc/ja/package/authentication/auth/auth/auth.xml +++ peardoc/ja/package/authentication/auth/auth/auth.xml <!-- $Revision: 1.1 $ --> <!-- Sync: 1.6 --> <refentry id="package.authentication.auth.auth.auth"> <refnamediv> <refname>Auth::Auth()</refname> <refpurpose>コンストラクタ</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef><function>Auth::Auth</function></funcdef> <paramdef>string <parameter>$storageDriver = "DB"</parameter></paramdef> <paramdef>mixed <parameter>$options = ""</parameter></paramdef> <paramdef>string <parameter>$loginFunction = ""</parameter></paramdef> <paramdef>boolean <parameter><optional>$showLogin = &true;</optional></parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.authentication.auth.auth.auth.desc"> &title.desc; <para> 認証システムコンストラクタです。 </para> </refsect1> <refsect1 id="package.authentication.auth.auth.auth.parameter"> &title.param; <para> <variablelist> <varlistentry> <term> &type.string; <parameter>$storageDriver</parameter> </term> <listitem> <para> 使用すべきストレージドライバーの名前です。 </para> </listitem> </varlistentry> <varlistentry> <term> &type.mixed; <parameter>$options</parameter> </term> <listitem> <para> ストレージコンテナに渡されるオプションです。 </para> </listitem> </varlistentry> <varlistentry> <term> &type.string; <parameter>$loginFunction</parameter> </term> <listitem> <para> ログイン画面を表示するユーザ定義関数の名前です。 </para> </listitem> </varlistentry> <varlistentry> <term> &type.bool; <parameter>$showLogin</parameter> </term> <listitem> <para> ログインがオプションかどうか定義します。 </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 id="package.authentication.auth.auth.auth.note"> &title.note; &note.notstatic; </refsect1> <refsect1 id="package.authentication.auth.auth.auth.see"> &title.see; <para> <link linkend="package.authentication.auth.intro-storage"> Introduction - The storage drivers </link> </para> </refsect1> <refsect1 id="package.authentication.auth.auth.auth.example"> &title.example; <example> <title>異なるDBパラメータの使用法</title> <programlisting role="php"> <![CDATA[ require_once "Auth/Auth.php"; function myOutput($username, $status) { ... /** See example 1 for the full listing */ } $params = array( "dsn" => "mysql://martin:test@localhost/auth", "table" => "myAuth", "usernamecol" => "myUserColumn", "passwordcol" => "myPasswordColumn" ); $a = new Auth("DB", $params, "myOutput"); $a->start(); if ($a->getAuth()) { echo "You have been authenticated successfully."; } ]]>; </programlisting> </example> <para> この例は、あなたがどのようにデータベーステーブル、 およびカラム名の代替名を指定出来るか示します。 この例では、テーブルmyAuthを使用します。 フィールドmyUserColumnからのユーザー名、 およびフィールドmyPasswordColumnからのパスワードを選択します。 このフィールドのデフォルトauth・usernameとpasswordです。 </para> <para> This feature is necessary if you want to use PEAR::Auth with a database layout that is different from the one, PEAR::Auth uses by default. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: peardoc/ja/package/authentication/auth/auth/getauth.xml +++ peardoc/ja/package/authentication/auth/auth/getauth.xml <!-- $Revision: 1.1 $ --> <!-- Sync: 1.3 --> <refentry id="package.authentication.auth.auth.getauth"> <refnamediv> <refname>Auth::getAuth()</refname> <refpurpose>ユーザが認証済みかどうか調べる</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef>boolean <function>Auth_HTTP::getAuth</function></funcdef> <paramdef></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.authentication.auth.auth.getauth.desc"> &title.desc; <para> ユーザが認証済みかどうか調べます。 </para> </refsect1> <refsect1 id="package.authentication.auth.auth.getauth.return"> &title.returns; <para> <parameter>boolean</parameter> - ユーザが既に認証済みならば、関数は&true;を返します。 そうでなければ、&false;を返します。 </para> </refsect1> <refsect1 id="package.authentication.auth.auth.getauth.note"> &title.note; &note.notstatic; </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: peardoc/ja/package/authentication/auth/auth/getstatus.xml +++ peardoc/ja/package/authentication/auth/auth/getstatus.xml <!-- $Revision: 1.1 $ --> <!-- Sync: 1.3 --> <refentry id="package.authentication.auth.auth.getstatus"> <refnamediv> <refname>Auth::getStatus()</refname> <refpurpose>現在の認証状況の情報を返す</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef>string <function>Auth::getStatus</function></funcdef> <paramdef></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.authentication.auth.auth.getstatus.desc"> &title.desc; <para> この関数は、PEAR::Authの現在のステータスを返します。 返り値は、PEAR Authにより定義される定数です。 </para> </refsect1> <refsect1 id="package.authentication.auth.auth.getstatus.return"> &title.returns; <para> <parameter>string</parameter> - 値は <constant>AUTH_IDLED</constant>, <constant>AUTH_EXPIRED</constant>, <constant>AUTH_EXPIRED</constant> になります。 </para> </refsect1> <refsect1 id="package.authentication.auth.auth.getstatus.note"> &title.note; &note.notstatic; </refsect1> <refsect1 id="package.authentication.auth.auth.getstatus.see"> &title.see; <para> <link linkend="package.authentication.auth.constants"> PEAR::Auth constants overview</link> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: peardoc/ja/package/authentication/auth/auth/setexpire.xml +++ peardoc/ja/package/authentication/auth/auth/setexpire.xml <!-- $Revision: 1.1 $ --> <!-- Sync: 1.3 --> <refentry id="package.authentication.auth.auth.setexpire"> <refnamediv> <refname>Auth::setExpire()</refname> <refpurpose>認証有効時間を設定する</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef>void <function>Auth::setExpire</function></funcdef> <paramdef>integer <parameter>$time</parameter></paramdef> <paramdef>boolean <parameter><optional>$add = &false;</optional></parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.authentication.auth.auth.setexpire.desc"> &title.desc; <para> この関数により、 認証で使用される最大有効期間を新しい値に設定することができます。 </para> </refsect1> <refsect1 id="package.authentication.auth.auth.setexpire.parameter"> &title.param; <para> <variablelist> <varlistentry> <term> &type.int; <parameter>$time</parameter> </term> <listitem> <para> 秒単位の認証有効時間 </para> </listitem> </varlistentry> <varlistentry> <term> &type.bool; <parameter>$add</parameter> </term> <listitem> <para> もし&true;<parameter>$time</parameter>の場合、 有効期限時間に追加します。 もし&false;の場合は、既存の値に置き換えられます。 </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 id="package.authentication.auth.auth.setexpire.note"> &title.note; &note.notstatic; </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: peardoc/ja/package/authentication/auth/auth/setsessionname.xml +++ peardoc/ja/package/authentication/auth/auth/setsessionname.xml <!-- $Revision: 1.1 $ --> <!-- Sync: 1.2 --> <refentry id="package.authentication.auth.auth.setsessionname"> <refnamediv> <refname>Auth::setSessionname()</refname> <refpurpose>カスタムセッション名を設定する</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef>void <function>Auth::setSessionname</function></funcdef> <paramdef>string <parameter>name</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.authentication.auth.auth.setsessionname.desc"> &title.desc; <para> この関数は、 ログイン時に作成させるセッション名を カスタマイズして設定することができます。 このセッション名のデフォルトは、"PHPSESSID"です。 </para> </refsect1> <refsect1 id="package.authentication.auth.auth.setsessionname.parameter"> &title.param; <para> <variablelist> <varlistentry> <term> &type.string; <parameter>$name</parameter> </term> <listitem> <para> 使用するセッション名 </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 id="package.authentication.auth.auth.setsessionname.note"> &title.note; &note.notstatic; <para> 同じドメインでAuthを用いるアプリケーションを複数実行する場合は、 <function>setSessionname</function>を使用する必要があります。 この関数を使用しない場合、 アプリケーションの一つに一度ログインしたユーザは、 再度ログインすることなしに他のアプリケーションも 使用することができてしまいます! </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: peardoc/ja/package/authentication/auth/auth/start.xml +++ peardoc/ja/package/authentication/auth/auth/start.xml <!-- $Revision: 1.1 $ --> <!-- Sync: 1.2 --> <refentry id="package.authentication.auth.auth.start"> <refnamediv> <refname>Auth::start()</refname> <refpurpose>認証を開始する</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef>void <function>Auth::start</function></funcdef> <paramdef></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.authentication.auth.auth.start.desc"> &title.desc; <para> 認証プロセスを開始します。 </para> </refsect1> <refsect1 id="package.authentication.auth.auth.start.note"> &title.note; &note.notstatic; </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->
« previous php.pear.doc (#1856) next »