[prev in list] [next in list] [prev in thread] [next in thread]
List: pear-doc
Subject: [PEAR-DOC] cvs: peardoc /en/package/text/text-captcha example.xml
From: "Christian Wenz" <wenz () php ! net>
Date: 2007-09-02 9:12:22
Message-ID: cvswenz1188724342 () cvsserver
[Download RAW message or body]
wenz Sun Sep 2 09:12:22 2007 UTC
Modified files:
/peardoc/en/package/text/text-captcha example.xml
Log:
updating example to new API (bug #11960)
http://cvs.php.net/viewvc.cgi/peardoc/en/package/text/text-captcha/example.xml?r1=1.4&r2=1.5&diff_format=u
Index: peardoc/en/package/text/text-captcha/example.xml
diff -u peardoc/en/package/text/text-captcha/example.xml:1.4 \
peardoc/en/package/text/text-captcha/example.xml:1.5
--- peardoc/en/package/text/text-captcha/example.xml:1.4 Sun Jun 24 08:11:13 2007
+++ peardoc/en/package/text/text-captcha/example.xml Sun Sep 2 09:12:22 2007
@@ -1,4 +1,4 @@
-<!-- $Revision: 1.4 $ -->
+<!-- $Revision: 1.5 $ -->
<sect2 id="package.text.text-captcha.example">
<title>Example</title>
@@ -21,18 +21,29 @@
require_once 'Text/CAPTCHA.php';
// Set CAPTCHA options (font must exist!)
+$imageOptions = array(
+ 'font_size' => 24,
+ 'font_path' => './',
+ 'font_file' => 'COUR.TTF',
+ 'text_color' => '#DDFF99',
+ 'lines_color' => '#CCEEDD',
+ 'background_color' => '#555555'
+);
+
+// Set CAPTCHA options
$options = array(
- 'font_size' => 24,
- 'font_path' => './',
- 'font_file' => 'COUR.TTF'
+ 'width' => 200,
+ 'height' => 80,
+ 'output' => 'png',
+ 'imageOptions' => $imageOptions
);
// Generate a new Text_CAPTCHA object, Image driver
$c = Text_CAPTCHA::factory('Image');
-$retval = $c->init(200, 80, null, $options);
+$retval = $c->init($options);
if (PEAR::isError($retval)) {
- echo 'Error generating CAPTCHA!';
- echo $retval->getMessage();
+ printf('Error initializing CAPTCHA: %s!',
+ $retval->getMessage());
exit;
}
@@ -68,7 +79,7 @@
$ok = false;
$msg = 'Please enter the text in the image in the field below!';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
- if (isset($_POST['phrase']) && isset($_SESSION['phrase']) &&
+ if (isset($_POST['phrase']) && is_string($_POST['phrase']) && \
isset($_SESSION['phrase']) &&
strlen($_POST['phrase']) > 0 && strlen($_SESSION['phrase']) > 0 &&
$_POST['phrase'] == $_SESSION['phrase']) {
$msg = 'OK!';
--
PEAR Documentation List Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic