public function validate($retType) { parent::validate($retType); copyArray($_POST, $v, '*'); if (trim($v['username']) == '') { $rets[] = array('msg' => 'Please enter your username!', 'field' => 'username'); } if (filter_var($v['email'], FILTER_VALIDATE_EMAIL) === FALSE) { $rets[] = array('msg' => 'Invalid email address!', 'field' => 'email'); } if ($v['password'] == '') { $rets[] = array('msg' => 'Please enter your password!', 'field' => 'password'); } if (strlen($v['password']) < 3) { $rets[] = array('msg' => 'Password must have at least 3 chars!', 'field' => 'password'); } if ($v['password'] != $v['cpassword']) { $rets[] = array('msg' => 'Passwords mismatched!', 'field' => 'cpassword'); } if (isset($rets)) { if (isset($retType) && $retType == RT_JSON) { return outputJson($rets); } else { return $rets; } } }
public function validate($retType) { parent::validate($retType); copyArray($_POST, $fv, 'username'); if (validateUsername($fv['username']) == false) { $rets[] = array('msg' => '<br/>Invalid username!', 'field' => 'username'); } if (isset($rets)) { if (isset($retType) && $retType == RT_JSON) { return outputJson($rets); } else { return $rets; } } }
public function validate($retType) { copyArray($_POST, $v, '*'); $rets = parent::validate($retType, $v); if (filter_var($v['email'], FILTER_VALIDATE_EMAIL) === FALSE) { $rets[] = array('msg' => 'Invalid email address!', 'field' => 'email', 'focus' => 'email'); } if (strlen($v['password']) < 3) { $rets[] = array('msg' => 'Password must have at least 3 chars!', 'field' => 'password', 'focus' => 'password'); } if ($v['password'] != $v['cpassword']) { $rets[] = array('msg' => 'Passwords mismatched!', 'field' => 'cpassword', 'focus' => 'cpassword'); } if (isset($retType) && $retType == RT_JSON && isset($rets)) return outputJson($rets); return $rets; }
public function validate($retType) { parent::validate($retType); copyArray($_POST, $fv, 'name', 'email', 'content'); if (trim($fv['name']) == '') { $rets[] = array('msg' => 'Please enter your name!', 'field' => 'name'); } if (filter_var($fv['email'], FILTER_VALIDATE_EMAIL) === FALSE) { $rets[] = array('msg' => 'Invalid email!', 'field' => 'email'); } if (trim($fv['content']) == '') { $rets[] = array('msg' => 'Please enter content!', 'field' => 'content'); } if (isset($rets)) { if (isset($retType) && $retType == RT_JSON) { return outputJson($rets); } else { return $rets; } } }
public function validate($retType) { parent::validate($retType); copyArray($_POST, $fv, 'name', 'email', 'msg'); if (trim($fv['name']) == '') { $rets[] = array('msg' => 'Please enter your name!', 'field' => 'name'); } if (filter_var($fv['email'], FILTER_VALIDATE_EMAIL) === FALSE) { $rets[] = array('msg' => 'Invalid email!', 'field' => 'email'); } if (trim($fv['msg']) == '') { $rets[] = array('msg' => 'Please enter your message!', 'field' => 'msg'); } if (ReCaptcha::checkAnswer() == false && isset($retType) && $retType == RT_JSON) { $rets[] = array('msg' => 'The reCAPTCHA wasn\'t entered correctly!', 'field' => 'recaptcha'); } if (isset($retType) && $retType == RT_JSON && isset($rets)) return outputJson($rets); return $rets; }