本文整理汇总了PHP中check_email函数的典型用法代码示例。如果您正苦于以下问题:PHP check_email函数的具体用法?PHP check_email怎么用?PHP check_email使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_email函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: safety_email
public function safety_email()
{
$safety_email = session('safety_email');
$auth_member = session('auth_member');
if (IS_POST && !$safety_email) {
$where['id'] = $auth_member['id'];
$where['pass'] = md5($_POST['pass']);
if ($res = M('Member')->where($where)->find()) {
session('safety_email', true);
$this->redirect("Member/safety_email");
} else {
$this->error('密码错误!');
}
} elseif (IS_POST && $safety_email) {
if (!check_email($_POST['email_code'])) {
$this->error('验证码错误或已过期!');
}
$_POST['id'] = $auth_member['id'];
$res = D('Member')->save_item($_POST);
if (!$res['status']) {
$this->error($res['error']);
} else {
session('safety_email', null);
$this->success('操作成功!', 'Member/safety');
}
} else {
$this->display();
}
}
示例2: send_recover_mail
function send_recover_mail($user)
{
global $site_key, $globals;
if (!check_email($user->email)) {
return false;
}
$now = time();
if (!empty($globals['email_domain'])) {
$domain = $globals['email_domain'];
} else {
$domain = get_server_name();
}
$key = md5($user->id . $user->pass . $now . $site_key . get_server_name());
$url = $globals['base_url'] . 'profile?login=' . $user->username . '&t=' . $now . '&k=' . $key;
//echo "$user->username, $user->email, $url<br />";
$to = $user->email;
$subject = _('Recuperación o verificación de contraseña de ') . get_server_name();
$subject = mb_encode_mimeheader($subject, "UTF-8", "B", "\n");
$message = $to . ': ' . _('para poder acceder sin la clave, conéctate a la siguiente dirección en menos de 15 minutos:') . "\n\n{$url}\n\n";
$message .= _('Pasado este tiempo puedes volver a solicitar acceso en: ') . "\nhttp://" . get_server_name() . $globals['base_url'] . "login?op=recover\n\n";
$message .= _('Una vez en tu perfil, puedes cambiar la clave de acceso.') . "\n" . "\n";
$message .= "\n\n" . _('Este mensaje ha sido enviado a solicitud de la dirección: ') . $globals['user_ip'] . "\n\n";
$message .= "-- \n " . _('el equipo de menéame');
$message = wordwrap($message, 70);
$headers = 'Content-Type: text/plain; charset="utf-8"' . "\n" . 'From: ' . _('Avisos') . ' ' . $domain . ' <' . _('no_contestar') . "@{$domain}>\n" . 'Reply-To: ' . _('no_contestar') . "@{$domain}\n" . 'X-Mailer: meneame.net' . "\n";
$headers .= 'MIME-Version: 1.0' . "\n";
//$pars = '-fweb@'.get_server_name();
mail($to, $subject, $message, $headers);
echo '<p><strong>' . _('Correo enviado, mira tu buzón, allí están las instrucciones. Mira también en la carpeta de spam.') . '</strong></p>';
return true;
}
示例3: check_email
/**
* Validates e-mail
* @param string $email
*/
public static function check_email($email)
{
if (check_email($email) == 0) {
echo 'Error validate e-mial';
exit;
}
}
示例4: Send
public function Send()
{
if(!$this->IsAvailable())
return false;
$arNotification = $this->Notify->getNotification();
//No need to send about updates;
if($arNotification["ACTION"] == "UPDATE")
return 0;
$arEmailSubscribe = array();
$arAllSubscribe = $this->GetList(array(), array("ID" => array(self::SUBSCRIBE_ALL, self::SUBSCRIBE_IDEA_COMMENT.$arNotification["POST_ID"])), false, false, array("USER_ID", "USER_EMAIL"));
while($r = $arAllSubscribe->Fetch())
if(check_email($r["USER_EMAIL"]))
$arEmailSubscribe[$r["USER_ID"]] = $r["USER_EMAIL"];
foreach($arEmailSubscribe as $UserId => $Email)
{
//Avoid to send notification to author
if($UserId == $arNotification["AUTHOR_ID"])
continue;
$arNotification["EMIAL_TO"] = $Email;
//ADD_IDEA_COMMENT, ADD_IDEA
CEvent::Send($arNotification["ACTION"].'_'.$arNotification["TYPE"], SITE_ID, $arNotification);
}
return count($arEmailSubscribe)>0;
}
示例5: registra_usuario
function registra_usuario($username, $password, $email)
{
global $db;
if (user_exists($username)) {
$mensaje_de_error = "El usuario " . $username . " ya existe";
} else {
if (check_email($email) == 0) {
$mensaje_de_error = "El mail no es válido";
} else {
if (email_exists($email)) {
$mensaje_de_error = "El mail " . $email . " ya existe";
} else {
$SELECT = "INSERT INTO usuarios ( usuario_login, usuario_password, usuario_email, usuario_nombre )";
$SELECT .= " VALUES ( '" . $username . "', '" . md5($password) . "', '" . $email . "', '" . $username . "' )";
$result = $db->get_results($SELECT);
logea("registro " . $username, "", $_SESSION["usuario"]);
//Creamos el ranking con un día atrás para que no obtenga beneficios de 60000 al actualizar el ranking hoy
$SELECT = "INSERT INTO ranking ( ranking_usuario, ranking_saldo, ranking_invertido, ranking_total, ranking_beneficio_hoy, ranking_fecha ) ";
$SELECT .= " VALUES ( '" . $username . "', '60000', '0', '60000', '0', CURDATE()-INTERVAL 1 DAY )";
$result = $db->get_results($SELECT);
}
}
}
return $mensaje_de_error;
}
示例6: page_contact
function page_contact()
{
// Add departments
global $_CLASS;
$_CLASS['core_user']->user_setup();
$_CLASS['core_user']->add_lang();
$this->error = '';
$this->preview = !empty($_POST['preview']);
if ($this->preview || !empty($_POST['contact'])) {
$this->data['MESSAGE'] = trim(get_variable('message', 'POST', ''));
$this->data['NAME'] = get_variable('sender_name', 'POST', '');
$this->data['EMAIL'] = get_variable('sender_email', 'POST', '');
foreach ($this->data as $field => $value) {
if (!$value) {
$this->error .= $_CLASS['core_user']->lang['ERROR_' . $field] . '<br />';
unset($field, $value, $lang);
} elseif ($field == 'EMAIL' && !check_email($value)) {
$this->error .= $_CLASS['core_user']->lang['BAD_EMAIL'] . '<br />';
}
}
if (!$this->error) {
$this->send_feedback();
}
} else {
$this->data['NAME'] = $_CLASS['core_user']->is_user ? $_CLASS['core_user']->data['username'] : '';
$this->data['EMAIL'] = $_CLASS['core_user']->is_user ? $_CLASS['core_user']->data['user_email'] : '';
$this->data['MESSAGE'] = '';
}
$_CLASS['core_template']->assign_array(array('ERROR' => $this->error, 'MESSAGE' => $this->data['MESSAGE'], 'ACTION' => generate_link($_CLASS['core_display']->page['page_name']), 'SENDER_EMAIL' => $this->data['EMAIL'], 'SENDER_NAME' => $this->data['NAME']));
$_CLASS['core_template']->display('modules/contact/index.html');
}
示例7: add_comment
/**
* add new comment
* @param int $id post id
* @param string $comment comment value
* @param int $parent_id 父评论的ID
*/
public function add_comment($id, $comment, $author = '', $email = '', $parent_id = 0, $type = 0)
{
if (empty($id) || empty($comment)) {
json_error(BigAppErr::$comment['code'], "empty id or comment");
}
$user_id = get_current_user_id();
$comment_type = bigapp_core::check_comment_status();
if ($comment_type == 2 && $user_id == 0) {
if ($author == '' or $email == '') {
json_error(BigAppErr::$comment['code'], 'need email or author');
}
if (false == check_email($email)) {
json_error(BigAppErr::$comment['code'], 'email format is wrong');
}
}
if ($comment_type == 3) {
if ($user_id == 0) {
json_error(BigAppErr::$login['code'], 'need login');
}
}
$commentdata = array("comment_post_ID" => $id, 'comment_content' => $comment, 'comment_approved' => 1, 'comment_author' => $author, 'comment_author_email' => $email, 'comment_parent' => $parent_id, "user_ID" => $user_id);
$result = wp_new_comment($commentdata);
if (!$result) {
json_error(BigAppErr::$comment['code'], "creat new comment failed");
}
return array('id' => $result);
}
示例8: checkEmail
/**
* @return mixed
*/
public static function checkEmail($value)
{
if (empty($value) || check_email($value)) {
return true;
} else {
return Loc::getMessage('SENDER_ENTITY_CONTACT_VALID_EMAIL');
}
}
示例9: set_email
function set_email($email)
{
if (!check_email($email)) {
$this->error_set('Comment::SetEmail:: incorrect email address.');
return false;
}
$this->email = trim($email);
return true;
}
示例10: check_regist_form
function check_regist_form($id, $passwd, $passwd2, $name, $email, $comment)
{
if (check_id($id) && check_passwd($passwd) && check_retype_passwd($passwd, $passwd2) && check_email($email) && check_comment($comment)) {
return TRUE;
// check_name($name) &&
} else {
return FALSE;
}
}
示例11: create_identity
public function create_identity($p)
{
$rcmail = rcmail::get_instance();
// prefs are set in create_user()
if ($this->prefs) {
if ($this->prefs['full_name']) {
$p['record']['name'] = $this->prefs['full_name'];
}
if (($this->identities_level == 0 || $this->identities_level == 2) && $this->prefs['email_address']) {
$p['record']['email'] = $this->prefs['email_address'];
}
if ($this->prefs['___signature___']) {
$p['record']['signature'] = $this->prefs['___signature___'];
}
if ($this->prefs['reply_to']) {
$p['record']['reply-to'] = $this->prefs['reply_to'];
}
if (($this->identities_level == 0 || $this->identities_level == 1) && isset($this->prefs['identities']) && $this->prefs['identities'] > 1) {
for ($i = 1; $i < $this->prefs['identities']; $i++) {
unset($ident_data);
$ident_data = array('name' => '', 'email' => '');
// required data
if ($this->prefs['full_name' . $i]) {
$ident_data['name'] = $this->prefs['full_name' . $i];
}
if ($this->identities_level == 0 && $this->prefs['email_address' . $i]) {
$ident_data['email'] = $this->prefs['email_address' . $i];
} else {
$ident_data['email'] = $p['record']['email'];
}
if ($this->prefs['reply_to' . $i]) {
$ident_data['reply-to'] = $this->prefs['reply_to' . $i];
}
if ($this->prefs['___sig' . $i . '___']) {
$ident_data['signature'] = $this->prefs['___sig' . $i . '___'];
}
// insert identity
$identid = $rcmail->user->insert_identity($ident_data);
}
}
// copy address book
$contacts = $rcmail->get_address_book(null, true);
if ($contacts && count($this->abook)) {
foreach ($this->abook as $rec) {
// #1487096 handle multi-address and/or too long items
$rec['email'] = array_shift(explode(';', $rec['email']));
if (check_email(idn_to_ascii($rec['email']))) {
$rec['email'] = idn_to_utf8($rec['email']);
$contacts->insert($rec, true);
}
}
}
// mark identity as complete for following hooks
$p['complete'] = true;
}
return $p;
}
示例12: gu_subscription_process
/**
* Processes (un)subscription requests to multiple lists
* @param string $address The email address
* @param array $list_ids The ids of the lists
* @param bool $subscribe TRUE if addresss should be subscribed to the lists, FALSE if it should be unsubscribed
* @return bool TRUE if operation was successful, else FALSE
*/
function gu_subscription_process($address, &$list_ids, $subscribe)
{
if (!check_email($address)) {
return gu_error(t("Invalid email address"));
}
$succ_list_names = array();
$fail_list_names = array();
// For each list we need to load it with all addresses
foreach ($list_ids as $list_id) {
$list = gu_list::get($list_id, TRUE);
// Don't allow subscriptions to private lists
if ($list->is_private()) {
$res = FALSE;
} else {
if ($subscribe) {
$res = $list->add($address, TRUE);
} else {
$res = $list->remove($address, TRUE);
}
}
if ($res) {
$succ_list_names[] = $list->get_name();
} else {
$fail_list_names[] = $list->get_name();
}
}
// Check if there were any successful
if (count($succ_list_names) < 1) {
return FALSE;
}
// Work out if we need to send any emails now, and if so create a sender
if (gu_config::get('list_send_welcome') || gu_config::get('list_send_goodbye') || gu_config::get('list_subscribe_notify') || gu_config::get('list_unsubscribe_notify')) {
$mailer = new gu_mailer();
if ($mailer->init()) {
$subject_prefix = count($succ_list_names) == 1 ? $succ_list_names[0] : gu_config::get('collective_name');
// Send welcome / goodbye message
if ($subscribe && gu_config::get('list_send_welcome') || !$subscribe && gu_config::get('list_send_goodbye')) {
$subject = '[' . $subject_prefix . '] ' . ($subscribe ? t('Subscription') : t('Unsubscription')) . t(' confirmation');
$action = $subscribe ? t('subscribed to') : t('unsubscribed from');
$text = t("This is an automated message to confirm that you have been % the following lists:", array($action)) . "\n\n* " . implode("\n* ", $succ_list_names) . "\n\n";
$text .= t('To change your subscriptions visit: ') . absolute_url('subscribe.php') . '?addr=' . $address . "\n\n";
$text .= t('Please do not reply to this message. Thank you.');
$mailer->send_mail($address, $subject, $text);
}
// Send admin notifications
if ($subscribe && gu_config::get('list_subscribe_notify') || !$subscribe && gu_config::get('list_unsubscribe_notify')) {
$subject = '[' . $subject_prefix . '] ' . ($subscribe ? t('Subscription') : t('Unsubscription')) . t(' notification');
$action = $subscribe ? t('subscribed to') : t('unsubscribed from');
$text = t("This is an automated message to notify you that % has been % the following lists:", array($address, $action)) . "\n\n* " . implode("\n* ", $succ_list_names) . "\n\n";
$mailer->send_admin_mail($subject, $text);
}
}
}
$action = $subscribe ? t('subscribed to') : t('unsubscribed from');
return gu_success(t('You have been % lists: <i>%</i>', array($action, implode('</i>, <i>', $succ_list_names))));
}
示例13: guestbook_add
function guestbook_add()
{
global $db;
if (isset($_POST['submit'])) {
$last = @$db->result(DB_PRE . 'ecp_comments', 'datum', 'bereich="guestbook" AND IP =\'' . strsave($_SERVER['REMOTE_ADDR']) . '\'');
if ($_POST['author'] == '' or $_POST['commentstext'] == '' or $_POST['captcha'] == '') {
table(ERROR, NOT_NEED_ALL_INPUTS);
$tpl = new smarty();
ob_start();
$tpl->display(DESIGN . '/tpl/guestbook/guestbook_add.html');
$content = ob_get_contents();
ob_end_clean();
main_content(GUESTBOOK_ADD, $content, '', 1);
} elseif (!check_email($_POST['email']) and $_POST['email'] != '') {
table(ERROR, WRONG_EMAIL);
$tpl = new smarty();
ob_start();
$tpl->display(DESIGN . '/tpl/guestbook/guestbook_add.html');
$content = ob_get_contents();
ob_end_clean();
main_content(GUESTBOOK_ADD, $content, '', 1);
} elseif (strtolower($_POST['captcha']) != strtolower($_SESSION['captcha'])) {
table(ERROR, CAPTCHA_WRONG);
$tpl = new smarty();
ob_start();
$tpl->display(DESIGN . '/tpl/guestbook/guestbook_add.html');
$content = ob_get_contents();
ob_end_clean();
main_content(GUESTBOOK_ADD, $content, '', 1);
} elseif ($last > time() - SPAM_GUESTBOOK or @(int) $_COOKIE['guestbook'] > time() - SPAM_GUESTBOOK) {
$last > time() - SPAM_GUESTBOOK ? $zeit = SPAM_GUESTBOOK + $last - time() : ($zeit = SPAM_GUESTBOOK + $_COOKIE['guestbook'] - time());
table(ERROR, str_replace(array('{sek}', '{zeit}'), array(SPAM_GUESTBOOK, $zeit), SPAM_PROTECTION_MSG));
$tpl = new smarty();
ob_start();
$tpl->display(DESIGN . '/tpl/guestbook/guestbook_add.html');
$content = ob_get_contents();
ob_end_clean();
main_content(GUESTBOOK_ADD, $content, '', 1);
} else {
$sql = sprintf('INSERT INTO ' . DB_PRE . 'ecp_comments (`bereich`, `author`, `beitrag`, `email`, `homepage`, `datum`, `IP`) VALUES ("guestbook", \'%s\', \'%s\', \'%s\', \'%s\', %d, \'%s\')', strsave(htmlspecialchars($_POST['author'])), strsave(comment_save($_POST['commentstext'])), strsave(htmlspecialchars($_POST['email'])), strsave(htmlspecialchars(check_url($_POST['homepage']))), time(), strsave($_SERVER['REMOTE_ADDR']));
if ($db->query($sql)) {
setcookie('guestbook', time(), time() + 365 * 86400);
header1('?section=guestbook');
}
}
unset($_SESSION['captcha']);
} else {
$tpl = new smarty();
ob_start();
$tpl->display(DESIGN . '/tpl/guestbook/guestbook_add.html');
$content = ob_get_contents();
ob_end_clean();
main_content(GUESTBOOK_ADD, $content, '', 1);
}
}
示例14: validate_new_id
protected function validate_new_id()
{
$email_check = check_email($this->id);
if ($email_check == '') {
return true;
} else {
$this->errormsg[] = $email_check;
$this->errormsg[$this->id_field] = Config::lang('pAdminCreate_admin_username_text_error1');
return false;
}
}
示例15: CheckOption
public function CheckOption($option, $value, $type)
{
if ($value == '') {
return trans('Empty option value is not allowed!');
}
switch ($type) {
case CONFIG_TYPE_POSITIVE_INTEGER:
if (!preg_match('/^[1-9][0-9]*$/', $value)) {
return trans('Value of option "$a" must be a number grater than zero!', $option);
}
break;
case CONFIG_TYPE_BOOLEAN:
if (!isboolean($value)) {
return trans('Incorrect value! Valid values are: 1|t|true|y|yes|on and 0|n|no|off|false');
}
break;
case CONFIG_TYPE_RELOADTYPE:
if ($value != 'sql' && $value != 'exec') {
return trans('Incorrect reload type. Valid types are: sql, exec!');
}
break;
case CONFIG_TYPE_DOCTYPE:
if ($value != 'html' && $value != 'pdf') {
return trans('Incorrect value! Valid values are: html, pdf!');
}
break;
case CONFIG_TYPE_EMAIL:
if (!check_email($value)) {
return trans('Incorrect email address!');
}
break;
case CONFIG_TYPE_MARGINS:
if (!preg_match('/^\\d+,\\d+,\\d+,\\d+$/', $value)) {
return trans('Margins should consist of 4 numbers separated by commas!');
}
break;
case CONFIG_TYPE_MAIL_BACKEND:
if ($value != 'pear' && $value != 'phpmailer') {
return trans('Incorrect mail backend. Valid types are: pear, phpmailer!');
}
break;
case CONFIG_TYPE_MAIL_SECURE:
if ($value != 'ssl' && $value != 'tls') {
return trans('Incorrect mail security protocol. Valid types are: ssl, tls!');
}
break;
case CONFIG_TYPE_DATE_FORMAT:
if (!preg_match('/%[aAdejuw]+/', $value) || !preg_match('/%[bBhm]+/', $value) || !preg_match('/%[CgGyY]+/', $value)) {
return trans('Incorrect date format! Enter format for day (%a, %A, %d, %e, %j, %u, %w), month (%b, %B, %h, %m) and year (%C, %g, %G, %y, %Y)');
}
break;
}
return NULL;
}