cvs: peardoc /en/package/authentication/auth-http/auth-http example.xml example2.xml
| From: | David Costa | Date: | Mon, 05 Apr 2004 17:27:46 +0000 |
| Subject: | cvs: peardoc /en/package/authentication/auth-http/auth-http example.xml example2.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-3192@lists.php.net to get a copy of this message | ||
gurugeek Mon Apr 5 13:27:46 2004 EDT
Added files:
/peardoc/en/package/authentication/auth-http/auth-http example.xml
example2.xml
Log:
New examples for auth-http by David Costa
http://cvs.php.net/co.php/peardoc/en/package/authentication/auth-http/auth-http/example.xml?r=1.1&p=1
Index: peardoc/en/package/authentication/auth-http/auth-http/example.xml
+++ peardoc/en/package/authentication/auth-http/auth-http/example.xml
<!-- $Revision: 1.1 $ -->
<refentry id="package.authentication.auth-http.auth-http.example">
<refnamediv>
<refname>Auth_HTTP Example</refname>
<refpurpose>Example: A simple password protected page</refpurpose>
</refnamediv>
<refsect1>
&title.example;
<programlisting role="php">
<![CDATA[
<?php
// example of Auth_HTTP basic implementation
require_once("Auth/HTTP.php");
// setting the database connection options
$AuthOptions = array(
'dsn'=>"pgsql://test:test@localhost/testdb",
'table'=>"testable", //your table name
'usernamecol'=>"username", //the database username column
'passwordcol'=>"password", //the database password column
'cryptType'=>"none", //password encryption type in your db
);
$a = new Auth_HTTP("DB", $AuthOptions);
$a->setRealm('yourrealm'); //realm name
$a->start(); //starting the authentication process
$a->setCancelText('<h2>Error 401</h2>'); // error message if
authentication fails
if($a->getAuth()) // checking for autenticated user
{
echo "Hello $a->username welcome to my secret page";
};
?>
]]>
</programlisting>
</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
-->
http://cvs.php.net/co.php/peardoc/en/package/authentication/auth-http/auth-http/example2.xml?r=1.1&p=1
Index: peardoc/en/package/authentication/auth-http/auth-http/example2.xml
+++ peardoc/en/package/authentication/auth-http/auth-http/example2.xml
<!-- $Revision: 1.1 $ -->
<refentry id="package.authentication.auth-http.auth-http.example2">
<refnamediv>
<refname>Auth_HTTP Example</refname>
<refpurpose>Example: A password protected page with multiple rows fetch and md5
password</refpurpose>
</refnamediv>
<refsect1>
&title.example;
<programlisting role="php">
<![CDATA[
<?php
// example of Auth_HTTP implementation with encrypted password and multiple columns fetch
require_once("Auth/HTTP.php");
// setting the database connection options
$AuthOptions = array(
'dsn'=>"pgsql://test:test@localhost/testdb",
'table'=>"testable", //your table name
'usernamecol'=>"username", //the database username column
'passwordcol'=>"password", //the database password column
'cryptType'=>"md5", //password encryption type in your db
'dbFields'=>"*", //enabling fetch for other db columns
);
$a = new Auth_HTTP("DB", $AuthOptions);
$a->setRealm('yourrealm'); //realm name
$a->start(); //starting the authentication process
$a->setCancelText('<h2>Error 401</h2>'); // error message if
authentication fails
if($a->getAuth()) // checking for autenticated user
{
echo "Hello $a->username welcome to my secret page <BR>";
echo "Your details on file are: <BR>";
echo $a->getAuthData('userid'); // retriving other details from the database row
echo $a->getAuthData('telephone'); // in this example the user id, telephone
number
echo $a->getAuthData('email'); // and email address
};
?>
]]>
</programlisting>
</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
-->