ASP4x-Captcha-Imager

 view release on metacpan or  search on metacpan

lib/ASP4x/Captcha/Imager.pm  view on Meta::CPAN

  
  IMG {
    border: dotted 1px #AAA;
  }
  </style>
  </head>
  <body>
    <form action="/handlers/dev.validate" method="post">
      <p>
        <label>Enter the code you see below:</label>
        <input type="text" name="security_code" />
      </p>
      <p>
        <label>&nbsp;</label>
        <img id="captcha" src="/handlers/dev.captcha?r=<%= rand() %>" alt="Security Code" />
        <a href="" onclick="document.getElementById('captcha').src = '/handlers/dev.captcha?r=' + Math.random(); return false">
          (Click for a new Image)
        </a>
      </p>
      <p>
        <label>&nbsp;</label>
        <input type="submit" value="Submit" />
      </p>
    </form>
  </body>
  </html>

=head2 Validate the Captcha

  package dev::validate;

  use strict;

lib/ASP4x/Captcha/Imager.pm  view on Meta::CPAN

is a good candidate for a Captcha.  Since it's so easy to use Captchas there really
isn't any reason not to use them anywhere you think B<might> benefit.  If you keep
the Captcha length short (see the first point in this list) then the humans won't
be too bothered by them and may actually be pleased with your consideration of their privacy.

=back

=head2 What About Fonts?

Because Linux systems tend to put fonts in several different places, I recommend
copying the font file (*.ttf) into the C<etc/> folder of your website and referencing it
(just like you see in the C<t/> folder of this distribution and in the SYNOPSIS example above.

Mono-space fonts are recommended over variable-width fonts.  So, "Courier New" is
recommended over Verdana.

=head1 SEE ALSO

L<ASP4>, L<Imager>

=head1 PREREQUISITES

t/htdocs/form.asp  view on Meta::CPAN

<html>
<body>

  <form action="/handlers/dev.validate" method="post">
    <p>
      <label>Enter the code you see below:</label>
      <input type="text" name="security_code" />
    </p>
    <p>
      <label>&nbsp;</label>
      <img id="captcha" src="/handlers/dev.captcha?r=<%= rand() %>" alt="Security Code" />
      <br/>
      <a href="" onclick="document.getElementById('captcha').src = '/handlers/dev.captcha?r=' + Math.random(); return false">
        (Click for a new Image)
      </a>
    </p>
    <p>
      <label>&nbsp;</label>
      <input type="submit" value="Submit" />
    </p>
  </form>

</body>
</html>



( run in 0.627 second using v1.01-cache-2.11-cpan-e1769b4cff6 )