pearweb
[ class tree: pearweb ] [ index: pearweb ] [ all elements ]

File: captcha-image.php

Source Location: /pearweb-1.1.5/public_html/captcha-image.php

Classes:

Page Details:

Produces a CAPTCHA image

Uses the value of $_SESSION['captcha'] for the image's text. That value is set in generate_captcha() in include/pear-format-html.php.

If $_SESSION['captcha'] is not set, the request is bogus, so exit without any output in order to save resources.

Rules:

  • Use fonts that are fuzzy.
  • Use a random font for each character.
  • Have each character be a random size, start at a random vertical location and appear at random angles.
  • Allow characters to sometimes overlap a little and flow a bit off the canvas.
  • Use two random colors for the foreground (text and arcs).
  • The foreground color must contrast with the background color.
  • The foreground arc colors must be the same as the text in order to make them harder to remove.
  • Some arcs will also be the background color, causing them to cut up the foreground items.
  • Encourage arcs not to touch the image's edges.
  • Have the arcs run from left to right as to not look like 1 or l.
  • Make sure each arc crosses through most of the text.
Based on a combination of concepts found in:
  • http://www.viebrock.ca/code/10/turing-protection
  • http://lists.nyphp.org/pipermail/talk/2004-June/010218.html
  • http://lists.nyphp.org/pipermail/talk/2004-July/010996.html
LICENSE: This source file is subject to version 3.0 of the PHP license that is available through the world-wide-web at the following URI: http://www.php.net/license/3_0.txt. If you did not receive a copy of the PHP License and are unable to obtain it through the web, please send a note to license@php.net so we can mail you a copy immediately.


Documentation generated on Sat, 06 Jan 2007 00:30:58 -0500 by phpDocumentor 1.3.0. PEAR Logo Copyright © PHP Group 2004.