<?
$oValidator = &new Validator();
$oValidator->mandatory = array(array("value"=>'', "msg"=>"Username"),
array("value"=>'u_email', "msg"=>"Email address"));
$oValidator->validation = array(array("value"=>"u_email", "func"=>"isEmail", "field"=>"Email address"),
array("value"=>"u_emai?l.", "func"=>"checkNotAllowChars", "field"=>"Email address", "pattern"=>"/\?/"));
$oValidator->equal = array(array("value1"=>"u_login2", "value2"=>"u_login", "field1"=>"Username", "field2"=>"Username"));
$oValidator->length = array(array("value"=>"u_login", "length_from"=>0, "length_to"=>2, "field"=>"Username", "coincide"=>false));
$out_error = $oValidator->validate();
if (count($out_error))
{
foreach($out_error as $k=>$v)
echo '<font color="red">'.$v."</font><br>";
}
unset ($oValidator);
?>
|