当前位置: 首页>>代码示例>>PHP>>正文


PHP FormValidator::checkMandatories方法代码示例

本文整理汇总了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);
开发者ID:barbercraig,项目名称:KP-nuts,代码行数:31,代码来源:process.php

示例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
开发者ID:barbercraig,项目名称:KP-nuts,代码行数:31,代码来源:prizedraw-process.php


注:本文中的FormValidator::checkMandatories方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。