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


PHP isValidEmail函数代码示例

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


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

示例1: doLogin

 public function doLogin()
 {
     $email = safe($_POST['email']);
     $password = safe($_POST['password']);
     $remember = 1;
     if (empty($email) || empty($password)) {
         // $this->redirect(U('w3g/Public/login'), 3, '用户名和密码不能为空');
         echo '用户名或密码不能为空';
         exit;
     }
     if (!isValidEmail($email)) {
         // $this->redirect(U('w3g/Public/login'), 3, 'Email格式错误,请重新输入');
         echo 'Email格式错误,请重新输入';
         exit;
     }
     if ($user = model('Passport')->getLocalUser($email, $password)) {
         // dump($user);
         if ($user['is_active'] == 0) {
             // $this->redirect(U('w3g/Public/login'), 3, '帐号尚未激活,请激活后重新登录');
             echo '帐号尚未激活,请激活后重新登录';
             exit;
         }
         model('Passport')->loginLocal($email, $password, $remember);
         $this->setSessionAndCookie($user['uid'], $user['uname'], $user['email'], intval($_POST['remember']) === 1);
         // $this->recordLogin($user['uid']);
         // model('Passport')->registerLogin($user, intval($_POST['remember']) === 1);
         echo '1';
         exit;
     } else {
         // $this->redirect(U('w3g/Public/login'), 3, '帐号或密码错误,请重新输入');
         echo '帐号或密码错误,请重新输入';
     }
 }
开发者ID:yang7hua,项目名称:hunshe,代码行数:33,代码来源:PublicAction.class.php

示例2: doLogin

 public function doLogin()
 {
     $email = safe($_POST['email']);
     $password = safe($_POST['password']);
     $remember = intval($_POST['login_remember']);
     if (empty($email) || empty($password)) {
         // redirect(U('wap/Public/login'), 3, '用户名和密码不能为空');
         echo '用户名和密码不能为空';
     }
     if (!isValidEmail($email)) {
         // redirect(U('wap/Public/login'), 3, 'Email格式错误,请重新输入');
         echo 'Email格式错误,请重新输入';
     }
     if ($user = model('Passport')->getLocalUser($email, $password)) {
         if ($user['is_active'] == 0) {
             // redirect(U('wap/Public/login'), 3, '帐号尚未激活,请激活后重新登录');
             echo '帐号尚未激活,请激活后重新登录';
         }
         model('Passport')->loginLocal($email, $password, $remember);
         // model('Passport')->registerLogin($user, intval($_POST['remember']) === 1);
         redirect(U('wap/Index/index'));
         // echo '1';
     } else {
         // redirect(U('wap/Public/login'), 3, '帐号或密码错误,请重新输入');
         echo '帐号或密码错误,请重新输入';
     }
 }
开发者ID:lyhiving,项目名称:icampus,代码行数:27,代码来源:PublicAction.class.php

示例3: sendResetEmail

	function sendResetEmail( $username ) {
		
		$username = sqlEscape( $username );
		$sql = "SELECT * FROM users WHERE username='$username'";
		$result = tmbo_query( $sql );
		if( mysql_num_rows( $result ) == 1 ) {
			$row = mysql_fetch_assoc( $result );
			$code = hashFromUserRow( $row );
			$message = "Someone (hopefully you) wants to reset your [this might be offensive] password. To reset your password, please visit the following link:

https://".$_SERVER['HTTP_HOST']."/offensive/pwreset.php?x=$code

			";
			
			if( isValidEmail( $row['email'] ) ) {

				mail( $row['email'], "resetting your [this might be offensive] password", $message, "From: offensive@thismight.be (this might be offensive)\r\n"/*bcc:ray@mysocalled.com"*/) or trigger_error("could not send email", E_USER_ERROR);

				echo "An email has been sent containing instructions for resetting your password.";
			}
			else {
				echo "Unfortunately, we don't have a valid email address for that account. There's nothing we can do for you.";
			}

		}

	}
开发者ID:numist,项目名称:this-might-be-offensive,代码行数:27,代码来源:pwreset.php

示例4: testValidEmailsTLD

 function testValidEmailsTLD()
 {
     $testemails = array('simple.email@domain.it', 'simple.email@domain.tld', 'simple.email@domain.stupid', 'simple.email@domain.cancerresearch', 'simple.email@domain.cancerresearch1', 'simple.email@domain.cancerresearch12', 'simple.email@domain.cancerresearch123');
     foreach ($testemails as $email) {
         $this->assertTrue(isValidEmail($email) !== false);
     }
 }
开发者ID:KeiroD,项目名称:Elkarte,代码行数:7,代码来源:TestSubs.php

示例5: handleAccountRequest

	function handleAccountRequest() {
		
		global $username, $password, $referralcode, $accountCreated;
		
		$message = null;
		
		$emailValidation = isValidEmail( $_REQUEST['email'] );
		
		if( ! $emailValidation->status ) {
			return $emailValidation;
		}
		
		if( isValidUsername( $username )
				&& isValidPassword( $password )
				&& $username != $password )
		{
			
			$result = createAccount( $username, $password, $referralcode );
			if( $result == "OK" ) {
				$message = new statusMessage( true, "Account created." );
				$accountCreated = true;
			} else {
				$message = new statusMessage( false, $result );
			}
			
		}
		else {
			$message = new statusMessage( false, "Invalid username or password. Passwords must be at least 5 characters long and may consist of letters, numbers, underscores, periods, and dashes. Passwords must not be the same as your username." );
		}
		
		return $message;
	
	}
开发者ID:numist,项目名称:this-might-be-offensive,代码行数:33,代码来源:registr.php

示例6: doAdminLogin

 public function doAdminLogin()
 {
     // 检查验证码
     if (md5($_POST['verify']) != $_SESSION['verify']) {
         $this->error('验证码错误');
     }
     // 数据检查
     if (empty($_POST['password'])) {
         $this->error('密码不能为空');
     }
     if (isset($_POST['email']) && !isValidEmail($_POST['email'])) {
         $this->error('email格式错误');
     }
     // 检查帐号/密码
     $is_logged = false;
     if (isset($_POST['email'])) {
         $is_logged = service('Passport')->loginAdmin(NULL, $_POST['email'], $_POST['password']);
     } else {
         if ($this->mid > 0) {
             $is_logged = service('Passport')->loginAdmin($this->mid, NULL, $_POST['password']);
         } else {
             $this->error('参数错误');
         }
     }
     // 提示消息不显示头部
     $this->assign('isAdmin', '1');
     if ($is_logged) {
         $this->assign('jumpUrl', U('admin/Index/index'));
         $this->success('登陆成功');
     } else {
         $this->assign('jumpUrl', U('home/Public/adminlogin'));
         $this->error('登陆失败');
     }
 }
开发者ID:laiello,项目名称:thinksns-2,代码行数:34,代码来源:PublicAction.class.php

示例7: checkEmail

function checkEmail($email, $vemail, $conn)
{
    // check if email exists in the database
    // $email = mysqli_escape_string();
    // $vemail = mysqli_escape_string();
    $query = "SELECT * FROM member WHERE email = '{$email}';";
    $result = mysqli_query($conn, $query);
    // check if email == vemail
    if ($email != $vemail) {
        $_SESSION['error'] = true;
        header('Location: registration.php?error=2');
        exit;
    }
    $validEmail = isValidEmail($email);
    if (!$validEmail) {
        header('Location: registration.php?error=2');
        exit;
    }
    // check if email is unique in the database
    if (mysqli_num_rows($result) != 0) {
        $_SESSION['error'] = true;
        header('Location: registration.php?error=3');
        exit;
    }
    // else email is unique
    return 1;
}
开发者ID:Trip09,项目名称:clickFraudCapstone,代码行数:27,代码来源:register.php

示例8: doAdminLogin

 public function doAdminLogin()
 {
     // 检查验证码
     if (md5($_POST['verify']) != $_SESSION['verify']) {
         $this->error(L('error_security_code'));
     }
     // 数据检查
     if (empty($_POST['password'])) {
         $this->error(L('password_notnull'));
     }
     if (isset($_POST['email']) && !isValidEmail($_POST['email'])) {
         $this->error(L('email_format_error'));
     }
     // 检查帐号/密码
     $is_logged = false;
     if (isset($_POST['email'])) {
         $is_logged = service('Passport')->loginAdmin($_POST['email'], $_POST['password']);
     } else {
         if ($this->mid > 0) {
             $is_logged = service('Passport')->loginAdmin($this->mid, $_POST['password']);
         } else {
             $this->error(L('parameter_error'));
         }
     }
     // 提示消息不显示头部
     $this->assign('isAdmin', '1');
     if ($is_logged) {
         $this->assign('jumpUrl', U('admin/Index/index'));
         $this->success(L('login_success'));
     } else {
         $this->assign('jumpUrl', U('home/Public/adminlogin'));
         $this->error(L('login_error'));
     }
 }
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:34,代码来源:PublicAction.class.php

示例9: _isValid

 protected function _isValid($value, $params)
 {
     $result = isValidEmail($value, getValueFromArray($params, Flag::VALIDATE_DOMAIN, false));
     if (!$result) {
         Factory::log()->warn("O e-mail {$value} não é um e-mail válido");
         return false;
     }
     return true;
 }
开发者ID:diego3,项目名称:myframework-core,代码行数:9,代码来源:DatatypeEmail.php

示例10: sendEmail

function sendEmail($email, $id)
{
    $msg = "Entry {$id} Inserted.";
    $msg = wordwrap($msg, 70);
    // send email if email is valid
    if (isValidEmail($email)) {
        mail($email, "Entry {$id} Inserted.", $msg);
    }
}
开发者ID:puuga,项目名称:health_project-2015,代码行数:9,代码来源:service_submit.php

示例11: TB_ContactForm

/** Contact Form **/
function TB_ContactForm($emailTo, $emailCC = FALSE, $sentHeading = 'Your message has been successfully submitted..', $sentMessage = 'We will get back to you asap.')
{
    if (isset($_POST['contact_submit'])) {
        $error = "";
        $fullname = makeSafe($_POST['fullname']);
        $email = makeSafe($_POST['email']);
        $phone = makeSafe($_POST['phone']);
        $message = makesafe($_POST['message']);
        $subject = "Enquiry from Canareef Resort Maldives";
        $from_name = "Canareef";
        $from_email = "reservations@canareef.com";
        if (empty($fullname)) {
            $error['fullname'] = "Your Name";
        }
        if (empty($email) || !isValidEmail($email)) {
            $error['email'] = "Your Email";
        }
        if (empty($message)) {
            $error['message'] = "Your Message";
        }
        if (!empty($_POST['antispam'])) {
            echo '<p>We don&rsquo;t appreciate spam.</p>';
        } elseif (!empty($error)) {
            TB_DisplayForm($error);
        } else {
            $content = __('Name') . ' : ' . $fullname . "\n" . __('Email') . ' : ' . $email . "\n" . __('Phone Number') . ' : ' . $phone . "\n" . __('Message') . " : \n" . $message . "\n\n";
            $headers = 'From: =?UTF-8?B?' . base64_encode($fullname) . '?= <' . $email . '>' . "\r\n";
            // $headers = 'From: =?UTF-8?B?'.base64_encode($from_name).'?= <'.$from_email.'>'."\r\n";
            $emailBCC = '';
            if ($emailCC) {
                $headers .= 'CC: ' . $emailCC . "\r\n";
            }
            if ($emailBCC != '') {
                $headers .= 'BCC: ' . $emailBCC . "\r\n";
            }
            $headers .= 'Reply-To: ' . $email . "\r\n";
            $headers .= 'Content-type: text/plain; charset=UTF-8';
            if (mail($emailTo, $subject, $content, $headers)) {
                echo '<a id="contact-status" name="status"></a>' . "\n";
                echo '<p class="tbSuccess">' . __($sentHeading) . ' ' . __($sentMessage) . '</p>' . "\n";
                $fullname = "";
                $email = "";
                $phone = "";
                $message = "";
            } else {
                $error['sendemail'] = "Email could not be sent.";
            }
            TB_DisplayForm($error);
        }
    } else {
        TB_DisplayForm();
    }
}
开发者ID:sindotnet,项目名称:canareef,代码行数:54,代码来源:index.php

示例12: validate

 function validate()
 {
     $ci =& get_instance();
     $user_name = $ci->session->userdata('user_name');
     if ($this->actionType == 'CREATE') {
         $this->record['user_name'] = trim($this->record['user_name']);
         $this->record['full_name'] = trim($this->record['full_name']);
         $this->record['user_pwd'] = md5($this->record['user_name']);
         if (isset($this->record['email_address'])) {
             if (!isValidEmail($this->record['email_address'])) {
                 throw new Exception("Your email address format is incorrect");
             }
         }
         $this->record['p_user_id'] = $this->generate_id('ifl', 'p_user', 'p_user_id');
         $this->record['creation_date'] = date('d/m/Y');
         $this->record['created_by'] = $user_name;
         $this->record['updated_date'] = date('d/m/Y');
         $this->record['updated_by'] = $user_name;
     } else {
         //do something
         if (isset($this->record['user_name'])) {
             $this->record['user_name'] = trim($this->record['user_name']);
             if (empty($this->record['user_name'])) {
                 throw new Exception('Username Field is Empty');
             }
         }
         if (isset($this->record['full_name'])) {
             $this->record['full_name'] = trim($this->record['full_name']);
             if (empty($this->record['full_name'])) {
                 throw new Exception('Fullname Field is Empty');
             }
         }
         if (isset($this->record['user_pwd'])) {
             if (trim($this->record['user_pwd']) == '') {
                 throw new Exception('Password Field is Empty');
             }
             if (strlen($this->record['user_pwd']) < 5) {
                 throw new Exception('Mininum password length is 5 characters');
             }
             $this->record['user_pwd'] = md5($this->record['user_pwd']);
         }
         if (isset($this->record['email_address'])) {
             if (!isValidEmail($this->record['email_address'])) {
                 throw new Exception("Email Format is Not Valid");
             }
         }
         $this->record['updated_date'] = date('d/m/Y');
         $this->record['updated_by'] = $user_name;
     }
     return true;
 }
开发者ID:wiliamdecosta,项目名称:ifalconi_oci_responsive,代码行数:51,代码来源:P_user.php

示例13: doCreateUser

function doCreateUser($email, $password)
{
    if (isValidEmail($email)) {
        if (isValidPassword($password)) {
            $db = dbconnect();
            $stmt = $db->prepare("INSERT INTO users SET email = :email, password = :password, created = now()");
            $binds = array(":email" => $email, ":password" => sha1($password));
            if ($stmt->execute($binds) && $stmt->rowCount() > 0) {
                return true;
            }
        }
    }
    return false;
}
开发者ID:shazard,项目名称:PHPClassSummer2015,代码行数:14,代码来源:signupfunctions.php

示例14: the_action_function

function the_action_function()
{
    $email = trim($_POST['email']);
    $success = true;
    try {
        if (!isValidEmail($email)) {
            throw new Exception('email not valid', 500);
        }
        echo json_encode(array('msg' => 'Thanks for signing up!'));
    } catch (Exception $e) {
        echo json_encode(array('error' => array('msg' => $e->getMessage(), 'code' => $e->getCode())));
    }
    die;
}
开发者ID:guitarbeard,项目名称:wordpress-test,代码行数:14,代码来源:email-eater.php

示例15: createNewUser

function createNewUser($email, $password)
{
    if (isValidEmail($email)) {
        if (isValidPassword($password)) {
            $db = getDB();
            $stmt = $db->prepare("INSERT INTO users SET email = :email, password = :password, created = now()");
            $hashedPassword = hash('sha1', $password);
            $binds = array(":email" => $email, ":password" => $hashedPassword);
            if ($stmt->execute($binds) && $stmt->rowCount() > 0) {
                return true;
            }
        }
    }
    return false;
}
开发者ID:slasher15987,项目名称:itchy-iguana,代码行数:15,代码来源:register-functions.php


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