本文整理汇总了PHP中isValidEmail函数的典型用法代码示例。如果您正苦于以下问题:PHP isValidEmail函数的具体用法?PHP isValidEmail怎么用?PHP isValidEmail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isValidEmail函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: [email protected] (this might be offensive)\r\n"/*bcc:[email protected]"*/) 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
开发者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 = "[email protected]";
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’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
示例16: createAnonUser
/**
* Creates a new anonymous user and fills the current obj with the info
* Desc: Tries to create an anonymous user.
* If the user already exists it will fill this obj with the users info.
* If the email is not a valid email it will throw an Invalid Email error
* @param: string $email the users email.
* @return: a pointer this object or false if the user already existed.
* @throw: Excption if invalid email.
* @acces: public
**/
function createAnonUser($email)
{
if (!isValidEmail($email)) {
throw new Exception('Invalid email.');
}
$this->email = $email;
if (!$this->find(true)) {
//The email doesn't exists.
$this->joinDate = date("Y-m-d");
$this->hash = md5($this->email . time());
$this->validated = 0;
} else {
return false;
}
return $this;
}
开发者ID:scirelli,项目名称:bod,代码行数:26,代码来源:anonymous_users.php
示例17: TB_ContactForm
/** Contact Form **/
function TB_ContactForm($emailTo, $emailCC = FALSE, $sentHeading = 'Your message was sent successfully.', $sentMessage = 'We will get back to you soon.')
{
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 Estadia by Hatten";
if (empty($fullname)) {
$error['fullname'] = "Your name";
}
if (empty($email) || !isValidEmail($email)) {
$error['email'] = "Email Address";
}
if (empty($message)) {
$error['message'] = "General Enquiry";
}
if (!empty($_POST['antispam'])) {
echo '<p>We don’t appreciate spam.</p>';
} elseif (!empty($error)) {
TB_DisplayForm($error);
} else {
$content = __('Name') . ' : ' . $fullname . "\n\n" . __('Email Address') . ' : ' . $email . "\n\n" . __('Contact No.') . ' : ' . $phone . "\n\n" . __('General Enquiry') . " : \n\n" . $message . "\n\n";
$headers = 'From: =?UTF-8?B?' . base64_encode($fullname) . '?= <' . $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";
} else {
$error['sendemail'] = "Email could not be sent.";
}
TB_DisplayForm($error);
}
} else {
TB_DisplayForm();
}
}
开发者ID:sindotnet,项目名称:dashhotel,代码行数:47,代码来源:index.php
示例18: adminLogin
/**
* 登录后台
* @return boolean 登录后台是否成功
*/
public function adminLogin()
{
if (is_numeric($_POST['uid'])) {
$map['uid'] = intval($_POST['uid']);
} elseif (isValidEmail(t($_POST['email']))) {
$map['email'] = t($_POST['email']);
} else {
$map['phone'] = t($_POST['email']);
}
$login = M('User')->where($map)->find();
$loginName = $login['phone'] ?: $login['email'];
if ($this->loginLocal($loginName, $_POST['password'])) {
$GLOBALS['ts']['mid'] = $_SESSION['adminLogin'] = intval($_SESSION['mid']);
return true;
} else {
return false;
}
}
开发者ID:songhongyu,项目名称:THINKSNS,代码行数:22,代码来源:PassportModel.class.php
示例19: doLogin
public function doLogin()
{
if (empty($_POST['email']) || empty($_POST['password'])) {
redirect(U('wap/Public/login'), 3, '用户名和密码不能为空');
}
if (!isValidEmail($_POST['email'])) {
redirect(U('wap/Public/login'), 3, 'Email格式错误,请重新输入');
}
if ($user = service('Passport')->getLocalUser($_POST['email'], $_POST['password'])) {
if ($user['is_active'] == 0) {
redirect(U('wap/Public/login'), 3, '帐号尚未激活,请激活后重新登录');
}
service('Passport')->registerLogin($user, intval($_POST['remember']) === 1);
redirect(U('wap/Index/index'));
} else {
redirect(U('wap/Public/login'), 3, '帐号或密码错误,请重新输入');
}
}
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:18,代码来源:PublicAction.class.php
示例20: validateUser
function validateUser($data)
{
$errorCodes = array();
if (!isValidName($data['name'])) {
$errorCodes[] = 'name';
}
if (!isValidEmail($data['email'])) {
$errorCodes[] = 'email';
}
if (!isValidCity($data['city'])) {
$errorCodes[] = 'city';
}
$valid = empty($errorCodes);
$result = array('valid' => $valid);
if (!$valid) {
$result['errorCodes'] = $errorCodes;
}
return $result;
}
开发者ID:bhasto,项目名称:test-project-php,代码行数:19,代码来源:create.php
注:本文中的isValidEmail函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论