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


PHP validateEmail函数代码示例

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


在下文中一共展示了validateEmail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 name@example.com";
            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@domena.cz", 60, trim($_POST['email']));
            insertOKSpan();
        } else {
            insertInputWithAddon("email", "email", "email", "Email@domena.cz", 60);
            insertWrongSpan();
        }
    } else {
        insertInputWithAddon("email", "email", "email", "Email@domena.cz", 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


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