ASP4x-Captcha-Imager

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

MANIFEST
META.yml
t/010-basic/000-setup.t
t/010-basic/010-compile.t
t/010-basic/020-basic.t
t/010-basic/030-form.t
t/conf/asp4-config.json
t/conf/httpd.conf
t/etc/LiberationSans-Regular.ttf
t/handlers/dev/captcha.pm
t/handlers/dev/validate.pm
t/htdocs/form.asp

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

    float:          left;
    padding-right:  5px;
  }
  
  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>

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

      <p>
        <label>&nbsp;</label>
        <input type="submit" value="Submit" />
      </p>
    </form>
  </body>
  </html>

=head2 Validate the Captcha

  package dev::validate;

  use strict;
  use warnings 'all';
  use base 'ASP4::FormHandler';
  use vars __PACKAGE__->VARS;

  sub run
  {
    my ($s, $context) = @_;
    

t/handlers/dev/validate.pm  view on Meta::CPAN


package dev::validate;

use strict;
use warnings 'all';
use base 'ASP4::FormHandler';
use vars __PACKAGE__->VARS;
use Digest::MD5 'md5_hex';

sub run
{
  my ($s, $context) = @_;

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)



( run in 0.329 second using v1.01-cache-2.11-cpan-4d50c553e7e )