本文整理汇总了PHP中FormValidator::checkMandatories方法的典型用法代码示例。如果您正苦于以下问题:PHP FormValidator::checkMandatories方法的具体用法?PHP FormValidator::checkMandatories怎么用?PHP FormValidator::checkMandatories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormValidator
的用法示例。
在下文中一共展示了FormValidator::checkMandatories方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MysqlFilter
$dbFilter = new MysqlFilter();
$cPost = array();
foreach ($_POST as $key => $value) {
$value = str_replace(",", "", $value);
$cPost[$key] = $dbFilter->dbPrepare($value);
}
//set mandatory fields
$newsletter_conf['mandatories'] = array("fname", "sname", "email-reg-news");
//set fields which must not contain numeric data
$newsletter_conf['non_numeric'] = array("fname", "sname");
//First, lets make sure there are is no numeric data in the name fields
$userValidate = UserDataValidator::getInstance($newsletter_conf['mandatories'], '');
if (!$userValidate->containsNumeric($cPost, $newsletter_conf['non_numeric'])) {
//continue with processing
//check mandatory information has been submitted
if (FormValidator::checkMandatories($newsletter_conf['mandatories'], $cPost)) {
//now check the email is a valid email
//check email entered is a valid email
$emailVerify = new EmailVerifier($cPost['email-reg-news']);
if ($emailVerify->partVerify()) {
//now we can check the entrant hasn't already entered
//check for email already in database
$sql = "SELECT count(*) FROM " . $newsletter_table . " where email='" . $cPost['email-reg-news'] . "'";
$qry = mysql_query($sql);
$results = mysql_fetch_array($qry);
$count = $results[0];
if ($count < 1) {
//haven't already entered, so enter them!
//insert record into table
$sql = "INSERT INTO " . $newsletter_table . " (fname, sname, email, ip, optin) VALUES ('" . $cPost['fname'] . "', '" . $cPost['sname'] . "', '" . $cPost['email-reg-news'] . "', '" . $ip . "', '" . $cPost['optin'] . "')";
$qry = mysql_query($sql, $db_object);
示例2: MysqlFilter
$dbFilter = new MysqlFilter();
$cPost = array();
foreach ($_POST as $key => $value) {
$value = str_replace(",", "", $value);
$cPost[$key] = $dbFilter->dbPrepare($value);
}
//set mandatory fields
$prizedraw_conf['mandatories'] = array("fname", "sname", "email", "terms");
//set fields which must not contain numeric data
$prizedraw_conf['non_numeric'] = array("fname", "sname");
//First, lets make sure there are is no numeric data in the name fields
$userValidate = UserDataValidator::getInstance($prizedraw_conf['mandatories'], '');
if (!$userValidate->containsNumeric($cPost, $prizedraw_conf['non_numeric'])) {
//continue with processing
//check mandatory information has been submitted
if (FormValidator::checkMandatories($prizedraw_conf['mandatories'], $cPost)) {
//now check email and confirm email match
if (FormValidator::fieldMatch($cPost['email'], $cPost['email_confirm'])) {
//now check the email is a valid email
//check email entered is a valid email
$emailVerify = new EmailVerifier($cPost['email']);
if ($emailVerify->partVerify()) {
//now we can check the entrant hasn't already entered
//check for email already in database
$sql = "SELECT count(*) FROM " . $prizedraw_table . " where email='" . $cPost['email'] . "'";
$qry = mysql_query($sql);
$results = mysql_fetch_array($qry);
$count = $results[0];
if ($count < 1) {
//haven't already entered, so enter them!
//insert record into table