本文整理汇总了PHP中valid_email函数的典型用法代码示例。如果您正苦于以下问题:PHP valid_email函数的具体用法?PHP valid_email怎么用?PHP valid_email使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了valid_email函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: insert
public function insert($data)
{
$this->load->helper('email');
if (array_valid($data)) {
// Ensure no bogus whitespace on any of the information
array_trim($data);
// Perform data validation
if (!isset($data['name']) or $data['name'] === '') {
$errors[] = 'Please enter a full name';
}
if (!valid_email($data['email'])) {
$errors[] = 'The email provided is not valid';
}
if (!isset($data['identity']) or $data['identity'] === '') {
$errors[] = 'Please enter a login';
}
if (!isset($data['magickey']) or $data['magickey'] === '') {
$errors[] = 'Please enter a password';
}
// Encode the password using sha1()
$data['magickey'] = sha1($data['magickey']);
// We have no errors so let's insert the new User
if (!array_valid($errors)) {
$this->db->insert('user', $data);
return TRUE;
}
} else {
$errors[] = 'No user information was provided';
}
if (array_valid($errors)) {
return $errors;
}
}
开发者ID:nac80,项目名称:bijoux-admin,代码行数:33,代码来源:user_model.php
示例2: doRegister
public function doRegister()
{
$email = $this->input->post('email');
$password = $this->input->post('password');
if (empty($email) || empty($password)) {
show_error('邮箱或密码不能为空', 100, $heading = 'An Error Was Encountered');
}
if (valid_email($email)) {
$data['email'] = $email;
// $passwd = substr($email, 0, strpos($email, '@')).rand(1, 999);
$data['password'] = md5($password);
$data['create_time'] = date('Y-m-d H:i:s');
$valid_user = $this->db->get_where('wufu', array('email' => $email))->row_array();
if (!empty($valid_user)) {
show_error('邮箱已经存在', 100, $heading = 'An Error Was Encountered');
}
$this->db->insert('wufu', $data);
$config['mailtype'] = 'html';
$this->load->library('email');
$this->email->initialize($config);
$this->email->from('[email protected]', '松鼠先生');
$this->email->to($email);
$this->email->subject('五福共享平台密码');
$this->email->message('您的五福共享平台密码是: ' . $password);
//$this->email->send();
redirect('login');
}
}
开发者ID:thomaslwq,项目名称:alipay-wufu,代码行数:28,代码来源:Login.php
示例3: join_member
function join_member($member)
{
$this->load->helper('email');
if ($member['email2'] != $member['email']) {
return ["error", "parameter err"];
}
if ($member['password2'] != $member['password']) {
return ["error", "parameter err"];
}
if (valid_email($member['email']) === false) {
return ["error", "email is not valid"];
}
if (strlen(htmlspecialchars($member['name'])) > 64) {
return ["error", "name is too long"];
}
if ($this->name_chk($member['name']) === false) {
return ["error", "name is duplicated"];
}
if ($this->email_chk($member['email']) === false) {
return ["error", "email is duplicated"];
}
if (!isset($member['lang'])) {
return ["error", "language parameter error"];
}
$m = ['email' => $member['email'], 'name' => htmlspecialchars($member['name']), 'password' => md5($member['password']), 'reg_date' => date('Y-m-d H:i:s', time()), 'reg_ip' => $this->input->ip_address(), 'lang' => $member['lang']];
if ($this->db->insert('users', $m) === false) {
return ["error", "unknown error"];
}
$this->load->model('achievement_model', 'achievement');
$this->achievement->take('default', $m['name']);
return true;
}
开发者ID:idkwim,项目名称:wargamekr,代码行数:32,代码来源:user_model.php
示例4: kontakt_mail
public function kontakt_mail()
{
$this->load->helper('email');
$this->load->library('email');
if (valid_email($this->input->post('mail'))) {
$config['mailtype'] = 'html';
$config['wordwrap'] = TRUE;
$this->email->initialize($config);
//izmeniti mejl from!!! Obavezno serverovu mejl adresu, zbog spama.
$this->email->from('[email protected]', 'Apoteka Biljana i Luka');
$mail = "<html><head></head><body>" . $this->input->post('textarea') . "<br>" . $this->input->post('mail') . "<br>" . $this->input->post('name') . "</body></html>";
$this->email->to('[email protected]');
$this->email->subject('Kontakt forma, sajt apoteke');
$this->email->message($mail);
$this->email->send();
$greska = 1;
//send_email('[email protected]', 'Apoteka 9 kontakt forma', $mail);
//redirect(base_url("index.php/index/kontakt"), 'refresh');
//echo $this->email->print_debugger();
} else {
$greska = 2;
}
redirect('index/kontakt/' . $greska, 'refresh');
//redirect(base_url("index.php/index/kontakt"), 'refresh');
}
开发者ID:hamednazari,项目名称:Vogram-1,代码行数:25,代码来源:index.php
示例5: check_account_email
function check_account_email($email)
{
$result = array('error' => false, 'message' => '');
// Caution: empty email isn't counted as an error in this function.
// Check for empty value separately.
if (!strlen($email)) {
return $result;
}
if (!valid_email($email) || !validate_email($email)) {
$result['message'] .= t('Not a valid email address') . EOL;
} elseif (!allowed_email($email)) {
$result['message'] = t('Your email domain is not among those allowed on this site');
} else {
$r = q("select account_email from account where account_email = '%s' limit 1", dbesc($email));
if ($r) {
$result['message'] .= t('Your email address is already registered at this site.');
}
}
if ($result['message']) {
$result['error'] = true;
}
$arr = array('email' => $email, 'result' => $result);
call_hooks('check_account_email', $arr);
return $arr['result'];
}
开发者ID:bashrc,项目名称:hubzilla,代码行数:25,代码来源:account.php
示例6: logar
public function logar()
{
// Recebe os dados
$email = $this->input->post('email');
$senha = $this->input->post('senha');
// Valida e-mail, se invalido retorna com erro
if (!valid_email($email)) {
$this->session->set_flashdata('erro', 'E-mail inválido');
redirect('/admin');
}
// Faz a consulta
$dados = $this->Model_admin_login->buscar_login($email, $senha);
// Se não encontra, retorna ao login com erro
if (!$dados) {
$this->session->set_flashdata('erro', 'Usuário ou senha inválidos');
redirect('/admin');
}
// verifica se o usuário está realmente ativo
$usuario_ativo = $this->Model_admin_login->usuario_ativo($email);
if (!$usuario_ativo) {
$this->session->set_flashdata('erro', 'Usuário bloqueado!');
redirect('/admin');
}
// Se encontra, carrega as sessoes e retorna a pagina principal
$dados['logado_admin'] = TRUE;
// Define a sessão que permite acesso ao sistema
$this->session->set_userdata($dados);
redirect('admin_agenda/');
}
开发者ID:helderhlp,项目名称:rogerioferreira,代码行数:29,代码来源:admin.php
示例7: send_mail
public function send_mail($to, $subject, $message, $from = '[email protected]', $name = 'reSeed', $cc = null, $bcc = null)
{
$from = '[email protected]';
$name = 'reSeed';
if (!valid_email($from)) {
return "Campo 'from' non valido";
}
if (!valid_email($to)) {
return "Campo 'to' non valido";
}
$this->CI->email->from($from, $name);
$this->CI->email->to($to);
$this->CI->email->subject($subject);
$this->CI->email->message($message);
if ($cc) {
$this->CI->email->cc($cc);
}
if ($bcc) {
$this->CI->email->bcc($bcc);
}
if ($this->CI->email->send()) {
return "OK";
} else {
return $this->CI->email->print_debugger();
}
}
开发者ID:reSeed,项目名称:Terminal-Dogma,代码行数:26,代码来源:Mailer.php
示例8: sendSuccessEmail
public function sendSuccessEmail($data)
{
$this->load->helper('email');
if (valid_email($data['email'])) {
send_email($data['email'], "Registration Suuccess", "Your Username <b>" . $data['username'] . "</b>, Password <b>" . $data['password'] . "</b>");
}
}
开发者ID:enamakel,项目名称:vugo,代码行数:7,代码来源:register.php
示例9: addFeedback
function addFeedback()
{
if (!$this->safety->allowByControllerName(__METHOD__)) {
return errorForbidden();
}
$this->load->helper('email');
$this->load->model('Users_Model');
$userId = (int) $this->session->userdata('userId');
$data = array();
if ($userId != USER_ANONYMOUS) {
$data = $this->Users_Model->get($userId);
}
$feedbackUserEmail = element('userEmail', $data);
if (valid_email($feedbackUserEmail) == false) {
$feedbackUserEmail = '';
}
$form = array('frmName' => 'frmFeedbackEdit', 'callback' => 'function(response) { $.Feedback.onSaveFeedback(response); };', 'fields' => array('feedbackId' => array('type' => 'hidden', 'value' => element('feedbackId', $data, 0)), 'feedbackUserName' => array('type' => 'text', 'label' => lang('Name'), 'value' => trim(element('userFirstName', $data) . ' ' . element('userLastName', $data))), 'feedbackUserEmail' => array('type' => 'text', 'label' => lang('Email'), 'value' => $feedbackUserEmail), 'feedbackDesc' => array('type' => 'textarea', 'label' => lang('Comment'), 'value' => '')), 'buttons' => array('<button type="submit" class="btn btn-primary"><i class="fa fa-comment"></i> ' . lang('Send') . '</button> '));
$form['rules'] = array(array('field' => 'feedbackUserName', 'label' => $form['fields']['feedbackUserName']['label'], 'rules' => 'trim|required'), array('field' => 'feedbackUserEmail', 'label' => $form['fields']['feedbackUserEmail']['label'], 'rules' => 'trim|required|valid_email'), array('field' => 'feedbackDesc', 'label' => $form['fields']['feedbackDesc']['label'], 'rules' => 'trim|required'));
$this->form_validation->set_rules($form['rules']);
if ($this->input->post() != false) {
$code = $this->form_validation->run();
if ($code == true) {
$this->Feedbacks_Model->saveFeedback($this->input->post());
}
if ($this->input->is_ajax_request()) {
return loadViewAjax($code);
}
}
$this->load->view('pageHtml', array('view' => 'includes/crForm', 'meta' => array('title' => lang('Feedback')), 'form' => $form, 'langs' => array('Thanks for contacting us')));
}
开发者ID:nsystem1,项目名称:cloneReader,代码行数:30,代码来源:feedbacks.php
示例10: forgotpassword
public function forgotpassword()
{
$data = '';
$post = $this->input->post();
if ($post) {
$error = array();
$e_flag = 0;
if (!valid_email(trim($post['email'])) && trim($post['email']) == '') {
$error['email'] = 'Please enter email.';
$e_flag = 1;
}
if ($e_flag == 0) {
$where = array('email' => trim($post['email']), 'role' => 'admin');
$user = $this->common_model->selectData(ADMIN, '*', $where);
if (count($user) > 0) {
$newpassword = random_string('alnum', 8);
$data = array('password' => md5($newpassword));
$upid = $this->common_model->updateData(ADMIN, $data, $where);
$emailTpl = $this->load->view('email_templates/admin_forgot_password', array('username' => $user[0]->name, 'password' => $newpassword), true);
$ret = sendEmail($user[0]->email, SUBJECT_LOGIN_INFO, $emailTpl, FROM_EMAIL, FROM_NAME);
if ($ret) {
$flash_arr = array('flash_type' => 'success', 'flash_msg' => 'Login details sent successfully.');
} else {
$flash_arr = array('flash_type' => 'error', 'flash_msg' => 'An error occurred while processing.');
}
$data['flash_msg'] = $flash_arr;
} else {
$error['email'] = "Invalid email address.";
}
}
$data['error_msg'] = $error;
}
$this->load->view('index/forgotpassword', $data);
}
开发者ID:niravpatel2008,项目名称:ubiquitous-octo-tatertot,代码行数:34,代码来源:index.php
示例11: index
function index()
{
$usersListQuery = $this->usersModel->getLastXUsers(6);
$footerWidebarData['usersListArr'] = $usersListQuery;
$contactStatus['contactStatus'] = false;
if ($this->input->post('submit')) {
$name = (string) $this->input->post('name', TRUE);
$email = (string) $this->input->post('email', TRUE);
$subject = (string) $this->input->post('subject', TRUE);
$message = (string) $this->input->post('message', TRUE);
if (empty($name) or empty($email) or empty($subject) or empty($message)) {
show_error("Toate campurile sunt obligatorii. Te rog sa completezi toate campurile si sa incerci din nou.");
}
if (!valid_email($email)) {
show_error("Adresa de mail nu este valida.");
}
$config['protocol'] = 'sendmail';
$this->email->initialize($config);
$this->email->from($email, $name);
$this->email->to('[email protected]');
$this->email->subject('NoiseStats Contact - ' . $subject);
$this->email->message($message);
$this->email->send();
$contactStatus['contactStatus'] = true;
$this->load->view('header');
$this->load->view('contact', $contactStatus);
$this->load->view('footer_widebar', $footerWidebarData);
$this->load->view('footer');
} else {
$this->load->view('header');
$this->load->view('contact', $contactStatus);
$this->load->view('footer_widebar', $footerWidebarData);
$this->load->view('footer');
}
}
开发者ID:radum,项目名称:noise-stats,代码行数:35,代码来源:contact.php
示例12: login
public function login($redirect = NULL)
{
if ($redirect === NULL) {
$redirect = $this->ag_auth->config['auth_login'];
}
$this->form_validation->set_rules('username', 'Username', 'required|min_length[6]');
$this->form_validation->set_rules('password', 'Password', 'required|min_length[6]');
if ($this->form_validation->run() == FALSE) {
$this->ag_auth->view('login');
} else {
$username = set_value('username');
$password = $this->ag_auth->salt(set_value('password'));
$field_type = valid_email($username) ? 'email' : 'username';
$user_data = $this->ag_auth->get_user($username, $field_type);
if (array_key_exists('password', $user_data) and $user_data['password'] === $password) {
unset($user_data['password']);
unset($user_data['id']);
$this->ag_auth->login_user($user_data);
redirect($redirect);
} else {
$data['message'] = "The username and password did not match.";
$this->ag_auth->view('message', $data);
}
}
// if($this->form_validation->run() == FALSE)
}
开发者ID:nonconforme,项目名称:ag-auth,代码行数:26,代码来源:MY_Controller.php
示例13: register
public function register($email_address,$password,$password_confirmation){
$this->load->helper('email');
if($password != $password_confirmation){
$this->errors[] = "Passwords did not match.";
return false;
}
if(strlen($password) < 6){
$this->errors[] = "Password is too short (must be 6 characters or more)";
return false;
}
if(!valid_email($email_address)){
$this->errors[] = "Email address is invalid.";
return false;
}
if($this->_email_taken($email_address)){
$this->errors[] = "An account already exists with that email. Did you <a href='/auth/forgot_password/>'forget your password</a>?";
return false;
}
$insert = array('email_address'=>$email_address,
'password'=>$this->_hash_password($password),
'active'=>1);
$this->db->insert('users',$insert);
return true;
}
开发者ID:rrrhys,项目名称:TimeManagementCI,代码行数:26,代码来源:auth_model.php
示例14: changeEmail
function changeEmail()
{
if (!$this->safety->allowByControllerName('profile/edit')) {
return errorForbidden();
}
$userId = $this->session->userdata('userId');
$data = $this->Users_Model->get($userId);
$this->load->helper('email');
$form = array('frmName' => 'frmChangeEmail', 'title' => lang('Change email'), 'buttons' => array('<button type="submit" class="btn btn-primary"><i class="fa fa-save"></i> ' . lang('Save') . ' </button>'), 'fields' => array('userEmail' => array('type' => 'text', 'label' => lang('Email'), 'value' => valid_email(element('userEmail', $data)) == true ? element('userEmail', $data) : '')));
$form['rules'] = array(array('field' => 'userEmail', 'label' => $form['fields']['userEmail']['label'], 'rules' => 'trim|required|valid_email|callback__validate_exitsEmail'));
$this->form_validation->set_rules($form['rules']);
if ($this->input->post() != false) {
if ($this->form_validation->run() == FALSE) {
return loadViewAjax(false);
}
$this->load->model(array('Tasks_Model'));
$userId = $this->session->userdata('userId');
$userEmail = $this->input->post('userEmail');
$confirmEmailKey = random_string('alnum', 20);
$this->Users_Model->updateConfirmEmailKey($userId, $userEmail, $confirmEmailKey);
$this->Tasks_Model->addTask('sendEmailToChangeEmail', array('userId' => $userId));
return loadViewAjax(true, array('notification' => lang('We have sent you an email with instructions to change your email')));
}
return $this->load->view('includes/crJsonForm', array('form' => $form));
}
开发者ID:nsystem1,项目名称:cloneReader,代码行数:25,代码来源:profile.php
示例15: index
function index()
{
if ($this->input->post("submit")) {
$email = $this->input->post("email");
$password = $this->input->post("password");
$confirm_password = $this->input->post("confirm_password");
if (empty($email) || empty($password) || empty($confirm_password)) {
return $this->view(array('error' => 'Please provide all fields.'));
}
if (strlen($password) < 6) {
return $this->view(array('error' => 'Password length is too short.'));
}
if ($password !== $confirm_password) {
return $this->view(array('error' => 'Passwords do not match.'));
}
$this->load->helper('email');
if (!valid_email($email)) {
return $this->view(array('error' => 'Not a valid email address.'));
}
$this->load->model('users_model');
if ($this->users_model->email_exists($email)) {
return $this->view(array('error' => 'User account already exists.'));
}
$this->users_model->create($email, $password);
return redirect('login');
}
return $this->view();
}
开发者ID:sjlu,项目名称:sns,代码行数:28,代码来源:register.php
示例16: submitforgot
function submitforgot()
{
$suc = '<button type="button" class="close" data-dismiss="alert" aria-label="Close" style="color:red"><span aria-hidden="true">×</span></button>';
$alerts = '<div class="alert alert-danger"><button type="button" class="close" data-dismiss="alert" aria-label="Close" style="color:red"><span aria-hidden="true">×</span></button>';
$alerta = '<div class="alert alert-info"><button type="button" class="close" data-dismiss="alert" aria-label="Close" style="color:red"><span aria-hidden="true">×</span></button>';
$this->load->library('email');
$this->load->helper('email');
$email = $this->input->post('email');
if (valid_email($email)) {
$config['protocol'] = "smtp";
$config['smtp_host'] = 'ssl://box997.bluehost.com';
$config['smtp_port'] = '465';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = '(O=_Yk8k|&A(rsr';
$config['mailtype'] = 'html';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['wordwrap'] = TRUE;
$this->email->initialize($config);
$this->email->from('[email protected]', 'Leyte Tourism Portal', '[email protected]');
$this->email->to($email);
$this->email->subject('Email Test');
$this->email->message('Please click the link for the password recovery');
$this->email->send();
$this->session->set_flashdata('message', $alerta . ' Password Recovery Has been Sent to ' . $email . '</div>');
} else {
$this->session->set_flashdata('message', $alerts . 'Invalid Email.</div>');
}
redirect('/forgot');
}
开发者ID:sonitgregorio,项目名称:leytetourismportal,代码行数:31,代码来源:Login.php
示例17: test_valid_email
public function test_valid_email()
{
$this->assertEquals(FALSE, valid_email('test'));
$this->assertEquals(FALSE, valid_email('test@[email protected]'));
$this->assertEquals(TRUE, valid_email('[email protected]'));
$this->assertEquals(TRUE, valid_email('[email protected]'));
}
开发者ID:texasag99,项目名称:pricebook,代码行数:7,代码来源:email_helper_test.php
示例18: get_user
/**
* get_user function.
*
* @access public
* @param mixed $user (default: null)
* @return void
*/
public function get_user($user = null)
{
$this->benchmark->mark('user_model_get_user_start');
$data = array();
if (is_int($user)) {
$data = array('id' => intval($user));
} else {
if (is_string($user)) {
if (valid_email($user)) {
$data = array('email' => $user);
} else {
$data = array('username' => $user);
}
} else {
return null;
}
}
$query = $this->db->get_where('users', $data);
if ($query->num_rows() > 0) {
$this->benchmark->mark('user_model_get_user_end');
return $query->row_array();
}
$this->benchmark->mark('user_model_get_user_end');
return null;
}
开发者ID:nyfagel,项目名称:klubb,代码行数:32,代码来源:user_model.php
示例19: get_email_addr
function get_email_addr() {
if (array_key_exists('text', $_REQUEST) and
array_key_exists('domain', $_REQUEST)) {
$is_text = true;
$text = valid_phone($_REQUEST['text']);
$domain = $_REQUEST['domain'];
$email = valid_email(sprintf("%s@%s", $text, $domain));
# Save for next time
$_SESSION['text'] = $text;
$_SESSION['domain'] = $domain;
} else if (array_key_exists('email', $_REQUEST)) {
$is_text = false;
$email = valid_email($_REQUEST['email']);
# Save for next time
$_SESSION['email'] = $email;
} else {
throw new Exception("No destination information provided.");
}
return array($email, $is_text);
}
开发者ID:hopkinsju,项目名称:MobileCat,代码行数:29,代码来源:send_email.php
示例20: api_verify_input
function api_verify_input($list_id, $timestamp_param = NULL)
{
$recipient_id = $this->CI->input->post('recipient_id');
if (empty($recipient_id)) {
$this->error = ['status' => 401, 'message' => 'missing parameter recipient_id'];
return NULL;
}
$to_name = $this->CI->input->post('to_name');
if (is_null($to_email = valid_email($this->CI->input->post('to_email')))) {
$this->error = ['status' => 401, 'message' => 'invalid email address in to_email'];
return NULL;
}
$timestamp = $this->CI->input->post($timestamp_param);
$timestamp = strtotime($timestamp);
if ($timestamp == FALSE) {
$this->error = ['status' => 401, 'message: timestamp parameter missing or ill formated'];
return NULL;
}
$timestamp = date('Y-m-d H:i:s', $timestamp);
$result = ['recipient_id' => $recipient_id, 'to_name' => $to_name, 'to_email' => $to_email, $timestamp_param => $timestamp];
if ($timestamp_param = 'metadata_updated') {
$metadata = $this->CI->input->post('metadata');
$metadata_json = (is_array($metadata) and !empty($metadata)) ? json_encode($metadata) : NULL;
$result['metadata_json'] = $metadata_json;
}
$recipient = $this->get($list_id, $recipient_id, $to_name, $to_email);
$result['recipient'] = $recipient;
return $result;
}
开发者ID:RimeOfficial,项目名称:postmaster,代码行数:29,代码来源:Lib_recipient.php
注:本文中的valid_email函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论