New Module
Dave Wilson
dw at botanicus.net
Thu Aug 29 02:27:49 CDT 2002
On Wed, Aug 28, 2002 at 10:48:59PM +0100, Scott McWhirter wrote:
> hello,
>
> got a new module done but want you guys to give some feedback before i
> release it to CPAN. The link is here:
> http://kungfuftr.com/code/Data-Field-Validate/
You might be interested in:
http://botanicus.net/dw/tmp/libinvalid.php.txt
It's basically the same sort of thing, except rules are hard-coded, it
can generate an HTML "you screwed up your input" page, it has no
internal error checking, oh wait, yeah, and it's written in PHP :]
require('libinvalid.php');
$post_rules = array(
'name' => 'name;len:16',
'password' => 'len:32',
'foo' => 'empty' /* actually non-empty */
);
if ($errs = inval($_POST, $post_rules)) {
$_inval_errlist['foo'] => 'Description of foo field';
$html = inval_errs_to_li($errs);
foreach(file("errorpage.html") as $line)
echo str_replace('$etxt', $html, $line);
die();
}
I gotskied carried away :/
More information about the Belfast-pm
mailing list