รายละเอียดของการตอบ ::
class P_register {
public $invalid = false;
public function Checkfield($text,$pattern,$min,$max,$format = false) {
if (strlen($text) >= 1 ) {
if (strlen($text) >= $min and strlen($text) <= $max) {
if ($format == false) {
if (preg_match($pattern,$text)) {
print "Your username is ok.";
$this->invalid = true;
} else {
print "Wrong username format.";
$this->invalid = false;
}
} elseif (ereg($pattern,$text)) {
print "You Username is ok.";
$this->invalid = true;
} else {
print "Wrong Username format.";
$this->invalid = true;
}
}
} else {
return "Blank !! You'd put your charater";
}
}