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


PHP validator::validate_fields方法代码示例

本文整理汇总了PHP中validator::validate_fields方法的典型用法代码示例。如果您正苦于以下问题:PHP validator::validate_fields方法的具体用法?PHP validator::validate_fields怎么用?PHP validator::validate_fields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在validator的用法示例。


在下文中一共展示了validator::validate_fields方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: header

    header('location: login.php?signup=no');
    exit;
}
if (isset($_POST['submit'])) {
    $my_form = new validator();
    $mail = new PHPMailer();
    $crypto = new phpFreaksCrypto();
    $firstname = $_POST['firstname'];
    $lastname = $_POST['lastname'];
    $email = $_POST['email'];
    $username = $_POST['username'];
    $password = $_POST['password'];
    $password2 = $_POST['password2'];
    if ($my_form->checkEmail($email)) {
        // check for good mail
        if ($my_form->validate_fields('firstname,lastname,email,username,password')) {
            // comma delimited list of the required form fields
            if ($password == $password2) {
                //create new user, disabled
                $username = mysql_real_escape_string(str_replace(' ', '_', $username));
                $sql = "SELECT userName FROM " . $db_prefix . "users WHERE userName='" . $username . "';";
                $result = mysql_query($sql);
                if (mysql_numrows($result) > 0) {
                    $display = '<div class="responseError">User already exists, please try another username.</div><br/>';
                } else {
                    $sql = "SELECT email FROM " . $db_prefix . "users WHERE email='" . mysql_real_escape_string($email) . "';";
                    $result = mysql_query($sql);
                    if (mysql_numrows($result) > 0) {
                        $display = '<div class="responseError">Email address already exists.  If this is your email account, please log in or reset your password.</div><br/>';
                    } else {
                        $salt = substr($crypto->encrypt(uniqid(mt_rand(), true)), 0, 10);
开发者ID:rbianco3,项目名称:phppickem,代码行数:31,代码来源:signup.php

示例2: validator

         }
     } else {
         $display = '<div class="responseError">Invalid email address, please try again.</div><br/>';
     }
     $action = 'add';
     break;
 case 'edit_action':
     $firstname = $_POST['firstname'];
     $lastname = $_POST['lastname'];
     $email = $_POST['email'];
     $userName = $_POST['userName'];
     $userID = (int) $_POST['userID'];
     $my_form = new validator();
     if ($my_form->checkEmail($_POST['email'])) {
         // check for good mail
         if ($my_form->validate_fields('firstname,lastname,email,userName')) {
             // comma delimited list of the required form fields
             //form is valid, perform update
             $sql = "update " . DB_PREFIX . "users ";
             $sql .= "set firstname = '" . $firstname . "', lastname = '" . $lastname . "', email = '" . $email . "', userName = '" . $userName . "' ";
             $sql .= "where userID = " . $userID . ";";
             $mysqli->query($sql) or die('error updating user');
             $display = '<div class="responseOk">User ' . $userName . ' Updated</div><br/>';
             /*
             				if ($_POST['password'] == $_POST['password2']) {
             				} else {
             					$display = '<div class="responseError">Passwords do not match, please try again.</div><br/>';
             				}*/
         } else {
             $display = '<div class="responseError">' . $my_form->error . '</div><br/>';
         }
开发者ID:numericOverflow,项目名称:phppickem,代码行数:31,代码来源:users.php


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