cvs: peardoc /fr/package/text/text-captcha example.xml information.xml intro.xml

From: Date: Wed, 10 Jan 2007 13:56:43 +0000
Subject: cvs: peardoc /fr/package/text/text-captcha example.xml information.xml intro.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-9276@lists.php.net to get a copy of this message
moosh Wed Jan 10 13:56:43 2007 UTC Added files: /peardoc/fr/package/text/text-captcha example.xml information.xml intro.xml Log: - initial translation

http://cvs.php.net/viewvc.cgi/peardoc/fr/package/text/text-captcha/example.xml?view=markup&rev=1.1 Index: peardoc/fr/package/text/text-captcha/example.xml +++ peardoc/fr/package/text/text-captcha/example.xml <?xml version="1.0" encoding="iso-8859-1" ?> <!-- $Revision: 1.1 $ --> <!-- $Id: example.xml,v 1.1 2007/01/10 13:56:43 moosh Exp $ --> <!-- EN-Revision: 1.3 Maintainer: moosh Status: ready --> <sect2 id="package.text.text-captcha.example"> <title>Exemple</title> <para> L'exemple qui suit implémente l'utilisation commune d'un CAPTCHA: Soumettre un formulaire de donnée qui ne sera pris en compte que si le CAPTCHA a correctement été résolu. </para> <example id="package.text.text-captcha.example.create"> <title>Créer un CAPTCHA</title> <para> Le code qui suit crée un CAPTCHA, provides the relevant information for the package, anhd retrieves the CAPTCHA as a PNG image. </para> <programlisting role="php"> require_once 'Text/CAPTCHA.php'; // Fixons les options du CAPTCHA (la fonte doit exister!) $options = array( 'font_size' => 24, 'font_path' => './', 'font_file' => 'COUR.TTF' ); // Générer un nouvel objet Text_CAPTCHA, pour le pilote Image $c = Text_CAPTCHA::factory('Image'); $retval = $c->init(200, 80, null, $options); if (PEAR::isError($retval)) { echo 'Erreur pendant la génération du CAPTCHA!'; exit; } // Récupérer la phrase secrete du CAPTCHA $_SESSION['phrase'] = $c->getPhrase(); // Prendre l'image CAPTCHA (PNG) $png = $c->getCAPTCHAAsPNG(); if (PEAR::isError($png)) { echo 'Erreur pendant la génération du CAPTCHA!'; exit; } file_put_contents(md5(session_id()) . '.png', $png); </programlisting> </example> <example id="package.text.text-captcha.example.secure"> <title>Protéger un formulaire avec un CAPTCHA</title> <para> Le code suivant implémente la fonctionnalité de vérification qu'un CAPTCHA a été correctement ou pas résolu. Pour cela, la phrase du CAPTCHA est stockée dans une variable de session pour conserver la l'information à comparer. Il est important de vider (unset) la session après résolution du CAPTCHA pour éviter une réutilisation de l'ID de session. </para> <programlisting role="php"> <![CDATA[ session_start(); $ok = false; $msg = 'Veuillez introduire dans le champs ci dessous '.. 'le texte qui apparait dans l\'image!'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (isset($_POST['phrase']) && isset($_SESSION['phrase']) && strlen($_POST['phrase']) > 0 && strlen($_SESSION['phrase']) > 0 && $_POST['phrase'] == $_SESSION['phrase']) { $msg = 'OK!'; $ok = true; unset($_SESSION['phrase']); } else { $msg = 'Veuillez ré-essayer!'; } unlink(md5(session_id()) . '.png'); } print "<p>$msg</p>"; if (!$ok) { // Crée le CAPTCHA comme vu ci-dessus // et l'envoyer au client } ]]> </programlisting> <para> Regardez le fichier <filename>CAPTCHA_test.php</filename> dans le paquet distribué pour un exemple complet et fonctionnel (support GD et TTF requis).</para> </example> </sect2> <!-- 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/viewvc.cgi/peardoc/fr/package/text/text-captcha/information.xml?view=markup&rev=1.1 Index: peardoc/fr/package/text/text-captcha/information.xml +++ peardoc/fr/package/text/text-captcha/information.xml <?xml version="1.0" encoding="iso-8859-1" ?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.4 Maintainer: moosh Status: started --> <!-- $Id: information.xml,v 1.1 2007/01/10 13:56:43 moosh Exp $ --> <sect2 id="package.text.text-captcha.information"> <title>Information about the CAPTCHA and inner workings</title> <para> <classname>Text_CAPTCHA</classname> provides information about the CAPTCHA and makes its inner workings accessible using several functions defined in the base class; the specific implementation of them is up to the driver. </para> <itemizedlist> <listitem> <simpara> <function>init</function> is used to initialize the CAPTCHA and provide further information, like <classname>Image_Text</classname> parameters. </simpara> </listitem> <listitem> <simpara> <function>_createCAPTCHA</function> generates the CAPTCHA, but is called internally by <function>init</function>. </simpara> <simpara> <function>getPhrase</function> returns the CAPTCHA's phrase. </simpara> </listitem> <listitem> <simpara> <function>_createPhrase</function> creates a phrase for the CAPTCHA, but is used internally. </simpara> </listitem> <listitem> <simpara> <function>getCAPTCHA</function> returns the CAPTCHA, the format used depends on the driver implementation. </simpara> </listitem> </itemizedlist> </sect2> <!-- 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/viewvc.cgi/peardoc/fr/package/text/text-captcha/intro.xml?view=markup&rev=1.1 Index: peardoc/fr/package/text/text-captcha/intro.xml +++ peardoc/fr/package/text/text-captcha/intro.xml <?xml version="1.0" encoding="iso-8859-1" ?> <!-- $Revision: 1.1 $ --> <!-- $Id: intro.xml,v 1.1 2007/01/10 13:56:43 moosh Exp $ --> <!-- EN-Revision: 1.4 Maintainer: moosh Status: started --> <sect2 id="package.text.text-captcha.intro"> <title>Introduction</title> <para> Ce package fourni les fonctionnalités pour créer un <acronym>CAPTCHAs</acronym> (Completely Automated Public Turing tests to tell Computers and Humans Apart). Les fonctionnalités proposées sont: </para> <itemizedlist> <listitem> <simpara> Créer un CAPTCHA graphique en utilisant GD2 </simpara> </listitem> <listitem> <simpara> Une architecture de "driver" pluggables en utilisant le pattern factory. </simpara> </listitem> <listitem> <simpara> <link linkend="package.text.text-captcha.information"> Des informations génériques à propos du CAPTCHA </link> </simpara> </listitem> </itemizedlist> <para> The package creates <acronym>CAPTCHAs</acronym>; due to the stateless nature of the HTTP protocol, the logic to secure a webpage using the package must be specifically implemented. Regardez <link linkend="package.text.text-captcha.example">l'exemple d'utilisation</link> pour des informations détaillées. </para> <para> Pour le moment, le driver graphique CAPTCHA dépend de Image_Text qui lui même requiert le support TTF qui doit être compilé en dans le PHP. </para> </sect2> <!-- 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 (#9276) next »