• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP validateEmail函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中validateEmail函数的典型用法代码示例。如果您正苦于以下问题:PHP validateEmail函数的具体用法?PHP validateEmail怎么用?PHP validateEmail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: validation_formulaire

/**
* Fonction vérrifiant que les données du formulaire sont correctement remplies et ajout des messages d'erreurs dans le formulaire en cas de problèmes
* @param [string, string] $a_valeur, tableau associatif contenant les données passées au travers du formulaire
* @return [bool] renvoie vrai si les données sont validées faux sinon.
*/
function validation_formulaire($a_valeur, &$info, $label)
{
    $retour = true;
    //Vérification du code anti-spam
    if (!isset($_SESSION['livreor']) || strcmp(strtoupper($_SESSION['livreor']), strtoupper($a_valeur['code'])) != 0) {
        $info["err_code"] = setRed($label["err_code"]);
        $retour = false;
    }
    //Vérification du mail
    if (!isset($a_valeur['email']) || !validateEmail($a_valeur['email'])) {
        $info["err_mail"] = setRed($label["err_mail"]);
        $retour = false;
    }
    //Vérification du nom
    if (!isset($a_valeur['nom']) || empty($a_valeur['nom'])) {
        $info["err_nom"] = setRed($label["err_nom"]);
        $retour = false;
    }
    //Vérification du sujet
    if (!isset($a_valeur['sujet']) || empty($a_valeur['sujet'])) {
        $info["err_sujet"] = setRed($label["err_sujet"]);
        $retour = false;
    }
    //Vérification du nom
    if (!isset($a_valeur['message']) || empty($a_valeur['message'])) {
        $info["err_message"] = setRed($label["err_message"]);
        $retour = false;
    }
    return $retour;
}
开发者ID:antrax2013,项目名称:soule-project,代码行数:35,代码来源:contactez-nous.php


示例2: sendEmail

function sendEmail($name, $email, $message)
{
    $to = get_option('smcf_to_email');
    $subject = get_option('smcf_subject');
    // Filter name
    $name = filter($name);
    // Filter and validate email
    $email = filter($email);
    if (!validateEmail($email)) {
        $subject .= " - invalid email";
        $message .= "\n\nBad email: {$email}";
        $email = $to;
    }
    // Add additional info to the message
    if (get_option('smcf_ip')) {
        $message .= "\n\nIP: " . $_SERVER['REMOTE_ADDR'];
    }
    if (get_option('smcf_ua')) {
        $message .= "\n\nUSER AGENT: " . $_SERVER['HTTP_USER_AGENT'];
    }
    // Set and wordwrap message body
    $body = "From: {$name}\n\n";
    $body .= "Message: {$message}";
    $body = wordwrap($body, 70);
    // Build header
    $header = "From: {$email}\n";
    $header .= "X-Mailer: PHP/SimpleModalContactForm";
    // Send email - suppress errors
    @mail($to, $subject, $body, $header) or die('Unfortunately, your message could not be delivered.');
}
开发者ID:shiuan0121,项目名称:simplemodal,代码行数:30,代码来源:smcf_data.php


示例3: checkingIfUserExists

/**
* Functions for checking if user exists
*/
function checkingIfUserExists()
{
    include_once 'validate.php';
    include_once 'functions.php';
    if (isset($_POST['email']) && isset($_POST['password'])) {
        $email = cleanInput($_POST['email']);
        $password = cleanInput($_POST['password']);
    }
    if (empty($email) || empty($password)) {
        echo "All fields are required. Please fill in all the fields.";
        exit;
    } else {
        /*checking correctness of form input*/
        $email = filter_var($email, FILTER_SANITIZE_EMAIL);
        if (validateEmail($email) == false) {
            echo "E-mail should be in the format of [email protected]";
            exit;
        }
        if (validateLength($password, 6) == false) {
            echo "Password should contain not less than 6 symbols";
            exit;
        }
        //$password_hash=password_hash($password, PASSWORD_DEFAULT); //PHP 5 >= 5.5.0
        $password_hash = md5($password);
        /*checking if user already exists*/
        if (checkLoggedUserInFile($email, $password_hash) == true) {
            //echo "Hello! You have logged in as ".$_SESSION['user_name'].".";
            header('Location:products.php');
            exit;
        } else {
            echo "No such user, or wrong password.<br>";
            //exit;
        }
    }
}
开发者ID:Atsumoriso,项目名称:Various-Tasks,代码行数:38,代码来源:authorize.php


示例4: validateData

function validateData()
{
    $required = $_GET["required"];
    $type = $_GET["type"];
    $value = $_GET["value"];
    validateRequired($required, $value, $type);
    switch ($type) {
        case 'number':
            validateNumber($value);
            break;
        case 'alphanum':
            validateAlphanum($value);
            break;
        case 'alpha':
            validateAlpha($value);
            break;
        case 'date':
            validateDate($value);
            break;
        case 'email':
            validateEmail($value);
            break;
        case 'url':
            validateUrl($value);
        case 'all':
            validateAll($value);
            break;
    }
}
开发者ID:16cameronk,项目名称:Anniversary,代码行数:29,代码来源:validate.php


示例5: create

 public function create($args)
 {
     extract(extractable(array('email', 'name', 'password'), $args));
     if ($email && $password) {
         $email = strtolower(trim($email));
         if (validateEmail($email)) {
             $ut = DBTable::get('users');
             if (!($rows = $ut->loadRowsWhere(array('email' => $email)))) {
                 $new = $ut->loadNewRow();
                 $new->name = $name;
                 $new->email = $email;
                 $new->password = sha1($password);
                 $new->created = time();
                 $new->save();
                 if ($new->users_id) {
                     return data::success($new->export());
                 }
                 return data::error("Unknown error saving user. Please try again.");
             }
             return data::error("email is already registered");
         }
         return data::error("invalid email");
     }
     return data::error("email and password required");
 }
开发者ID:soldair,项目名称:solumLite,代码行数:25,代码来源:users.class.php


示例6: sendEmail

function sendEmail($name, $email, $message) {
	global $to, $subject, $extra;

	// Filter name
	$name = filter($name);

	// Filter and validate email
	$email = filter($email);
	if (!validateEmail($email)) {
		$subject .= " - invalid email";
		$message .= "\n\nBad email: $email";
		$email = $to;
	}

	// Add additional info to the message
	if ($extra['ip']) {
		$message .= "\n\nIP: " . $_SERVER['REMOTE_ADDR'];
	}
	if ($extra['user_agent']) {
		$message .= "\n\nUSER AGENT: " . $_SERVER['HTTP_USER_AGENT'];
	}

	// Set and wordwrap message body
	$body = "From: $name\n\n";
	$body .= "Message: $message";
	$body = wordwrap($body, 70);

	// Build header
	$header = "From: $email\n";
	$header .= "X-Mailer: PHP/SimpleModalContactForm";

	// Send email
	@mail($to, $subject, $body, $header) or 
		die('Unfortunately, your message could not be delivered.');
}
开发者ID:none-da,项目名称:Favmeal,代码行数:35,代码来源:contact.php


示例7: register

 function register($username, $password, $email, $type = 'g')
 {
     if (empty($username) || empty($password) || !validateEmail($email)) {
         return false;
     }
     $rt = uc_user_register($username . '#' . $type, $password, $email);
     if ($rt > 0) {
         return array('result' => $rt, 'message' => 'register success!!');
     }
     switch ($rt) {
         case -1:
             $return = array('result' => -1, 'message' => 'invalid username!!');
             break;
         case -2:
             $return = array('result' => -2, 'message' => 'illegal words has beed found!!');
             break;
         case -3:
             $return = array('result' => -3, 'message' => 'usename exist!!');
             break;
         case -4:
             $return = array('result' => -4, 'message' => 'invalid email address!!');
             break;
         case -5:
             $return = array('return' => -5, 'message' => 'email not allow!!');
             break;
         case -6:
             $return = array('return' => -6, 'message' => 'email has been used!!');
             break;
     }
     return $return;
 }
开发者ID:sjw-github,项目名称:lib,代码行数:31,代码来源:ucClient.ini.php


示例8: ValidateRegisterForm

function ValidateRegisterForm($post)
{
    if (validateFirstName($post['firstName']) && validateLastName($post['lastName']) && validateEmail($post['email']) && validatePassword($post['password']) && validateConfirmPassword($post['confirmPassword']) && validateGender($post['gender']) && validateContactNumber($post['contactNumber']) && validateAddress($post['address'])) {
        return true;
    } else {
        return false;
    }
}
开发者ID:pawans-optimus,项目名称:php_induction,代码行数:8,代码来源:validateRegisterForm.php


示例9: emailIsValid

 private function emailIsValid($otheremail = '')
 {
     if (empty($otheremail)) {
         $email = $this->toEmail;
     } else {
         $email = $otheremail;
     }
     return validateEmail($email);
 }
开发者ID:soldair,项目名称:solumLite,代码行数:9,代码来源:email.class.php


示例10: contact_validate

function contact_validate($app, $deployment, $contactInfo)
{
    foreach ($contactInfo as $key => $value) {
        switch ($key) {
            case "use":
            case "host_notification_period":
            case "service_notification_period":
            case "host_notification_commands":
            case "service_notification_commands":
                validateForbiddenChars($app, $deployment, '/[^\\w.-]/s', $key, $value);
                break;
            case "retain_status_information":
            case "retain_nonstatus_information":
            case "host_notifications_enabled":
            case "service_notifications_enabled":
            case "can_submit_commands":
                validateBinary($app, $deployment, $key, $value);
                break;
            case "host_notification_options":
                $opts = validateOptions($app, $deployment, $key, $value, array('d', 'u', 'r', 's', 'n'), true);
                $contactInfo[$key] = $opts;
                break;
            case "service_notification_options":
                $opts = validateOptions($app, $deployment, $key, $value, array('w', 'u', 'c', 'r', 's', 'n'), true);
                $contactInfo[$key] = $opts;
                break;
            case "email":
                validateEmail($app, $deployment, $key, $value);
                break;
            case "pager":
                if (filter_var($value, FILTER_VALIDATE_EMAIL) === false) {
                    if (!preg_match("/^(?[2-9][0-8][0-9])?-[2-9][0-0]{2}-[0-9]{4}\$/", $value)) {
                        $apiResponse = new APIViewData(1, $deployment, "Unable use pager number provided, the value provided doesn't match the regex for pager or email address");
                        $apiResponse->setExtraResponseData('parameter', $key);
                        $apiResponse->setExtraResponseData('parameter-value', $value);
                        $apiResponse->setExtraResponseData('parameter-pager-regex', "/^(?[2-9][0-8][0-9])?-[2-9][0-0]{2}-[0-9]{4}\$/");
                        $app->halt(404, $apiResponse->returnJson());
                    }
                }
                break;
            case "contactgroups":
                if (is_array($value)) {
                    $value = implode(',', $value);
                }
                validateForbiddenChars($app, $deployment, '/[^\\w.-]/s', $key, $value);
                break;
            default:
                break;
        }
    }
    return $contactInfo;
}
开发者ID:NetworkCedu,项目名称:saigon,代码行数:52,代码来源:contact.route.php


示例11: validateFormInputs

function validateFormInputs()
{
    if (validateName()) {
        if (validateEmail()) {
            if (validateMessage()) {
                if (validateHiddenInput()) {
                    return true;
                }
            }
        }
    }
    return false;
}
开发者ID:jjaros,项目名称:patchwork-verka,代码行数:13,代码来源:FormValidator.php


示例12: UserSignUp

 function UserSignUp()
 {
     if (isset($_POST['su-btn-submit'])) {
         if (isset($_POST['email']) && isset($_POST['username']) && isset($_POST['password']) && isset($_POST['confirm-password']) && isset($_POST['tos-checkbox'])) {
             //Get submitted values
             $email = validateEmail($_POST['email']) ? 1 : 0;
             $user = validateUsername($_POST['username']) ? 1 : 0;
             $password = validatePassword($_POST['password']) ? 1 : 0;
             $password_hash = password_hash($_POST['password'], PASSWORD_DEFAULT);
             $cf_pass = password_verify($_POST['confirm-password'], $password_hash) ? 1 : 0;
             $tos_cb = $_POST['tos-checkbox'] ? 1 : 0;
         }
     }
 }
开发者ID:ansidev,项目名称:maya-notes-web,代码行数:14,代码来源:site.class.php


示例13: _wpr_newsletter_form_validate

function _wpr_newsletter_form_validate(&$info, &$errors, $whetherToValidateNameUniqueness = true)
{
    $errors = array();
    if (empty($_POST['name'])) {
        $errors[] = __("The newsletter name field was left empty. Please fill it in to continue.");
        $info['name'] = '';
    } else {
        if ($whetherToValidateNameUniqueness === true && checkIfNewsletterNameExists($_POST['name'])) {
            $errors[] = __("A newsletter with that name already exists. ");
            $info['name'] = '';
        } else {
            $info['name'] = $_POST['name'];
        }
    }
    if (empty($_POST['fromname'])) {
        $errors[] = __("The 'From Name' field was left empty. Please fill it in to continue. ");
        $info['fromname'] = '';
    } else {
        $info['fromname'] = $_POST['fromname'];
    }
    if (empty($_POST['fromemail'])) {
        $errors[] = __("The 'From Email' field was left empty. Please fill it in to continue. ");
        $info['fromemail'] = '';
    } else {
        if (!validateEmail($_POST['fromemail'])) {
            $errors[] = __("The email address provided for 'From Email' is not a valid e-mail address. Please enter a valid email address.");
            $info['fromemail'] = '';
        } else {
            $info['fromemail'] = $_POST['fromemail'];
        }
    }
    if (empty($_POST['reply_to'])) {
        $errors[] = _("The 'Reply-To' field was left empty. Please fill in an email address in the reply-to field.");
        $info['reply_to'] = '';
    } else {
        if (!validateEmail($_POST['reply_to'])) {
            $errors[] = _("The 'Reply-To' field was filled with an invalid e-mail address. Please fill in a valid email address.");
            $info['reply_to'] = '';
        } else {
            $info['reply_to'] = $_POST['reply_to'];
        }
    }
    $info['id'] = $_POST['id'];
    $info['description'] = $_POST['description'];
    $info['fromname'] = $_POST['fromname'];
    $info['fromemail'] = $_POST['fromemail'];
    $info = apply_filters("_wpr_newsletter_form_validation", $info);
    $errors = apply_filters("_wpr_newsletter_form_validation_errors", $errors);
}
开发者ID:rpiket,项目名称:WP-Autoresponder,代码行数:49,代码来源:newsletters.php


示例14: insertMailInput

function insertMailInput()
{
    if (isset($_POST['odeslat'])) {
        if (validateEmail()) {
            insertInputAddonWithValue("email", "email", "email", "[email protected]", 60, trim($_POST['email']));
            insertOKSpan();
        } else {
            insertInputWithAddon("email", "email", "email", "[email protected]", 60);
            insertWrongSpan();
        }
    } else {
        insertInputWithAddon("email", "email", "email", "[email protected]", 60);
        insertWrongSpan();
    }
}
开发者ID:jjaros,项目名称:patchwork-verka,代码行数:15,代码来源:ContactFormMaker.php


示例15: auth_client

function auth_client($email)
{
    if (is_client_logged()) {
        return true;
    }
    if (!validateEmail($email)) {
        return false;
    }
    $client = Client::findOneBy(array('email' => $email));
    if (!$client) {
        return false;
    }
    $_SESSION["frame"]["client"] = $client;
    return true;
}
开发者ID:yonkon,项目名称:diplom,代码行数:15,代码来源:func.php


示例16: check

 public function check($source, $items = array())
 {
     foreach ($items as $item => $rules) {
         foreach ($rules as $rule => $rule_value) {
             $value = trim($source[$item]);
             $item = escape($item);
             if ($rule === 'required' && empty($value)) {
                 $this->addError("{$item} is required");
             } else {
                 if (!empty($value)) {
                     switch ($rule) {
                         case 'min':
                             if (strlen($value) < $rule_value) {
                                 $this->addError("{$item} must be minimum of {$rule_value} characters.");
                             }
                             break;
                         case 'max':
                             if (strlen($value) > $rule_value) {
                                 $this->addError("{$item} must be maximum of {$rule_value} characters.");
                             }
                             break;
                         case 'matches':
                             if ($value != $source[$rule_value]) {
                                 $this->addError("{$rule_value} must match {$item}");
                             }
                             break;
                         case 'unique':
                             $result = $this->_db->query("SELECT id FROM user_info WHERE {$rule_value} = {$value}");
                             if ($result->num_rows) {
                                 $this->addError("{$item} : {$value} already exists");
                             }
                             break;
                         case 'email':
                             if (!validateEmail($value)) {
                                 $this->addError("{$item} is invalid");
                             }
                             break;
                     }
                 }
             }
         }
     }
     if (empty($this->_errors)) {
         $this->_passed = true;
     }
 }
开发者ID:CCNITSilchar,项目名称:Social-Login-Plugin,代码行数:46,代码来源:Validate.php


示例17: ValidateEmailExtra

function ValidateEmailExtra($email)
{
    $pattern = "/[^a-z0-9_@.]+/i";
    $email_to_validate = $email;
    if (!preg_match($pattern, $email_to_validate)) {
        if (!empty($email)) {
            if (validateEmail($email_to_validate)) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    } else {
        return false;
    }
}
开发者ID:JstMagic,项目名称:dynamicPDO,代码行数:18,代码来源:validate.php


示例18: Registration

function Registration($mail, $pass, $gender, $usertype)
{
    if (checkvaliduser($mail) == true) {
        if ($pass != '' && $mail != '') {
            if (validateEmail($mail)) {
                $insert_id = insertintousers($mail, $pass, $gender, $usertype);
                if (is_numeric($insert_id) && $insert_id > 0) {
                    header("location:login.php");
                }
            } else {
                echo "Please Enter Valide email.";
            }
        } else {
            echo "Please Enter Valide email and Password.";
        }
    } else {
        echo "This is not Valide Email.";
    }
}
开发者ID:Gorakh12345,项目名称:leadershipe,代码行数:19,代码来源:usefunction.php


示例19: checkingFormAndSaveNewUser

/**
* Functions for checking & validating form
*/
function checkingFormAndSaveNewUser()
{
    include_once 'validate.php';
    if (isset($_POST['username']) && isset($_POST['email']) && isset($_POST['password']) && isset($_POST['confirm_password']) && isset($_POST['agree'])) {
        $username = cleanInput($_POST['username']);
        $email = cleanInput($_POST['email']);
        $password = cleanInput($_POST['password']);
        $confirm_password = cleanInput($_POST['confirm_password']);
        $agree = $_POST['agree'];
        if (validateUsername($username) == false) {
            echo "Name should contain capitals and lower case, not less than 2 symbols";
            exit;
        }
        $email = filter_var($email, FILTER_SANITIZE_EMAIL);
        if (validateEmail($email) == false) {
            echo "E-mail should be in the format of [email protected]";
            exit;
        }
        if (validateLength($password, 6) == false) {
            echo "Password should contain not less than 6 symbols";
            exit;
        }
        if (validateConfirm($password, $confirm_password) == false) {
            echo "Passwords do not match";
            exit;
        }
        //$password_hash=password_hash($password, PASSWORD_DEFAULT); //PHP 5 >= 5.5.0
        $password_hash = md5($password);
        $dir_for_saved_users = "./user/";
        if (!is_dir($dir_for_saved_users)) {
            mkdir($dir_for_saved_users, 0777, true);
        }
        chmod('./user/', 0777);
        $filename = $dir_for_saved_users . "user_info";
        $new_user_info = $username . ":" . $email . ":" . $password_hash . "\n";
        file_put_contents($filename, $new_user_info, FILE_APPEND);
        //$_SESSION['name'] = $username;
        echo "You have signed up successfully! <a href='index.php'>Log in</a>";
    } else {
        echo "All fields are required. Please fill in all the fields.";
        exit;
    }
}
开发者ID:Atsumoriso,项目名称:Various-Tasks,代码行数:46,代码来源:save_user_info.php


示例20: validate

function validate($array)
{
    $isGood = false;
    foreach ($_POST as $key => $value) {
        $value = trim(strip_tags($value));
        $_POST[$key] = $value;
        $isGood = false;
        switch ($key) {
            case 'email':
                $isGood = validateEmail($value);
                break;
            default:
                $isGood = strlen($value) > 2;
        }
        if (!$isGood) {
            return false;
        }
    }
    return $isGood;
}
开发者ID:nbockoven,项目名称:find-tanner-a-home,代码行数:20,代码来源:email.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP validateEmailAddress函数代码示例发布时间:2022-05-23
下一篇:
PHP validateDeletion函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap