本文整理汇总了PHP中checkMail函数的典型用法代码示例。如果您正苦于以下问题:PHP checkMail函数的具体用法?PHP checkMail怎么用?PHP checkMail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了checkMail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authentication
/**
* Выполнить аутентификацию
*
* @param string $mail почта
* @param string $password пароль
* @param bool $autologin помнить на сайте
* @throws UserException Пользователь не существует
* @throws UserException Неверный пароль
* @throws UserException Пользователь не активирован
* @throws UserException Неверный формат почты
*/
public function authentication($mail, $password, $autologin = false, $isMd5 = false)
{
$bad = true;
if (checkMail($mail)) {
$res = $this->_sql->query("SELECT `id` , `mail` , `password` , INET_NTOA( `ip` ) AS `ip` , `register_date` , `name` , `second_name` , `gender` , `burthday` , `photo` , `country` , `region` , `city` , `street` , `utc_time` , `state` , `status` FROM `SITE_USERS` WHERE `mail`='{$mail}'");
$userResult = $this->_sql->GetRows($res);
if ($userResult == NULL) {
throw new UserException($mail, UserException::USR_NOT_EXSIST);
}
$userResult = $userResult[0];
$this->userID = $userResult["id"];
if (!$isMd5) {
$password = md5($password);
}
if ($userResult["password"] != $password) {
throw new UserException($mail, UserException::USR_PASSWORD_INCORRECT);
} else {
if ($this->checkIfActivated($userResult)) {
if ($autologin) {
setcookie("sec", md5($this->userID) . md5($userResult["mail"]), time() + 221356800, "/");
setcookie("id", $this->userID, time() + 221356800, "/");
}
$_SESSION["user"] = $userResult;
} else {
throw new UserException($mail, UserException::USR_NOT_ACTIVATED);
}
}
} else {
throw new UserException($mail, UserException::USR_NAME_INCORRECT);
}
return true;
}
示例2: addComment
function addComment($params)
{
$name = isset($_POST['comname']) ? addslashes(trim($_POST['comname'])) : '';
$content = isset($_POST['comment']) ? addslashes(trim($_POST['comment'])) : '';
$mail = isset($_POST['commail']) ? addslashes(trim($_POST['commail'])) : '';
$url = isset($_POST['comurl']) ? addslashes(trim($_POST['comurl'])) : '';
$imgcode = isset($_POST['imgcode']) ? addslashes(trim(strtoupper($_POST['imgcode']))) : '';
$blogId = isset($_POST['gid']) ? intval($_POST['gid']) : -1;
$pid = isset($_POST['pid']) ? intval($_POST['pid']) : 0;
if (ISLOGIN === true) {
$CACHE = Cache::getInstance();
$user_cache = $CACHE->readCache('user');
$name = addslashes($user_cache[UID]['name_orig']);
$mail = addslashes($user_cache[UID]['mail']);
$url = addslashes(BLOG_URL);
}
if ($url && strncasecmp($url, 'http', 4)) {
$url = 'http://' . $url;
}
doAction('comment_post');
$Comment_Model = new Comment_Model();
$Comment_Model->setCommentCookie($name, $mail, $url);
if ($Comment_Model->isLogCanComment($blogId) === false) {
emMsg('评论失败:该文章已关闭评论');
} elseif ($Comment_Model->isCommentExist($blogId, $name, $content) === true) {
emMsg('评论失败:已存在相同内容评论');
} elseif (ROLE == ROLE_VISITOR && $Comment_Model->isCommentTooFast() === true) {
emMsg('评论失败:您提交评论的速度太快了,请稍后再发表评论');
} elseif (empty($name)) {
emMsg('评论失败:请填写姓名');
} elseif (strlen($name) > 20) {
emMsg('评论失败:姓名不符合规范');
} elseif ($mail != '' && !checkMail($mail)) {
emMsg('评论失败:邮件地址不符合规范');
} elseif (ISLOGIN == false && $Comment_Model->isNameAndMailValid($name, $mail) === false) {
emMsg('评论失败:禁止使用管理员昵称或邮箱评论');
} elseif (!empty($url) && preg_match("/^(http|https)\\:\\/\\/[^<>'\"]*\$/", $url) == false) {
emMsg('评论失败:主页地址不符合规范', 'javascript:history.back(-1);');
} elseif (empty($content)) {
emMsg('评论失败:请填写评论内容');
} elseif (strlen($content) > 8000) {
emMsg('评论失败:内容不符合规范');
} elseif (ROLE == ROLE_VISITOR && Option::get('comment_needchinese') == 'y' && !preg_match('/[\\x{4e00}-\\x{9fa5}]/iu', $content)) {
emMsg('评论失败:评论内容需包含中文');
} elseif (ISLOGIN == false && Option::get('comment_code') == 'y' && session_start() && (empty($imgcode) || $imgcode !== $_SESSION['code'])) {
emMsg('评论失败:验证码错误');
} else {
$_SESSION['code'] = null;
$Comment_Model->addComment($name, $content, $mail, $url, $imgcode, $blogId, $pid);
}
}
示例3: register
/**
* Зарегистрировать нового пользователя в системе
*
* @param string $mail Почта
* @param string $password Пароль
* @param string $name Имя
* @param string $surname Фамилия
* @param string $burthday Дата рождения
* @param bool $gender Пол
* @param integer $ip IP
* @throws UserException Если пользователь уже существует
* @throws UserException Если неверна дата рождения
* @throws UserException Не заполнены имя и фамилия
* @throws UserException Неверный формат почты
*/
public function register($mail, $password, $name, $surname, $burthday, $gender, $ip)
{
if (checkMail($mail)) {
if ($this->checkIfExsist($mail)) {
throw new UserException($mail, UserException::USR_ALREADY_EXIST);
}
if (!checkDateFormat($burthday)) {
throw new UserException($mail, UserException::USR_CHECK_BURTHDAY);
} else {
if ($name == "" && $surname == "") {
throw new UserException($mail, UserException::USR_NAME_EMPTY);
}
}
$textPassword = $password;
$password = md5($password);
$date = date("Y-m-d");
$query = "\r\n INSERT INTO `SITE_USERS` SET\r\n `mail`='{$mail}',\r\n `password`='{$password}',\r\n `ip`={$ip},\r\n `register_date`='{$date}',\r\n `name`='{$name}',\r\n `second_name`='{$surname}',\r\n `gender`={$gender},\r\n `burthday`='{$burthday}'\r\n ";
$this->_sql->query($query);
$querySelectId = $this->_sql->selFieldsWhere("SITE_USERS", "`mail`='{$mail}'", "id");
$arr = $this->_sql->GetRows($querySelectId);
$id = $arr[0]["id"];
$activationKey = $this->generateActivationKey(7);
$insertActivationRowData = array($id, $activationKey);
$this->_sql->insert("USERS_ACTIVATION_KEYS", $insertActivationRowData);
$p = new UserMailer();
$p->mail = $mail;
$embeddedImages = array("photos/no-photo.jpg", "photos/no-galary.jpg");
$s = new SmartyExst();
$s->assign("NAME", "{$name} {$surname}");
$s->assign("PASS", $textPassword);
$s->assign("ID", $id);
$s->assign("KEY", $activationKey);
$sendString = $s->fetch($this->mailTemplate);
$p->registerSend($sendString, $embeddedImages);
return $id;
} else {
throw new UserException($mail, UserException::USR_NAME_INCORRECT);
}
}
示例4: addMitglied
/**
* Fügt ein Mitglied in die Datenbank ein und setzt den Status auf "aktiv"
*
* @param String $name
* @param String $vorname
* @param Varchar $email
* @param String $faktor
*
* @return Integer Success/Error Code
*/
public function addMitglied($name, $vorname, $email, $faktor)
{
if (!checkMail($email)) {
return -1;
} else {
$cSql = "SELECT * FROM " . _TBL_MA_ . " WHERE name = LOWER('" . $name . "') OR email = LOWER('" . $email . "')";
if (!($result = mysql_query($cSql, $this->DBConn)) || mysql_num_rows($result) == 0) {
$sql = "INSERT INTO " . _TBL_MA_ . " (name, vorname, email, eintritt, faktor) \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES ('" . $name . "', '" . $vorname . "', '" . $email . "', CURDATE(), '" . $faktor . "')";
if (!($result = mysql_query($sql, $this->DBConn)) || mysql_affected_rows($this->DBConn) != 1) {
return -2;
} else {
$sSql = "INSERT INTO " . _TBL_MA_STAT_ . " (maId, status, datum) VALUES (LAST_INSERT_ID(), 1, CURDATE())";
if (!($result = mysql_query($sSql, $this->DBConn)) || mysql_affected_rows($this->DBConn) != 1) {
return -3;
} else {
return 1;
}
}
} else {
return -4;
}
}
}
示例5: stripslashes
$data = $c->get();
$c->close();
$i['post']['face_url'] = stripslashes(textMiddle($data, '<img class=portrait-img src=\\x22', '\\x22>'));
}
/*
受信任的设置项,如果插件要使用系统的API去储存设置,必须通过set_save1或set_save2挂载点挂载设置名
具体挂载方法为:
global $PostArray;
$PostArray[] = '设置名';
为了兼容旧版本,可以global以后检查一下是不是空变量,为空则为旧版本
*/
$PostArray = array('face_img', 'face_baiduid', 'face_url');
doAction('set_save1');
//更改邮箱
if ($_POST['mail'] != $i['user']['email'] && !empty($_POST['mail'])) {
if (checkMail($_POST['mail'])) {
$mail = sqladds($_POST['mail']);
$z = $m->once_fetch_array("SELECT COUNT(*) AS total FROM `" . DB_NAME . "`.`" . DB_PREFIX . "users` WHERE email='{$mail}'");
if ($z['total'] > 0) {
msg('修改失败:邮箱已经存在');
}
$m->query("UPDATE `" . DB_PREFIX . "users` SET `email` = '{$mail}' WHERE `id` = '" . UID . "';");
} else {
msg('邮箱格式有误,请检查');
}
}
$set = array();
foreach ($PostArray as $value) {
if (!isset($i['post'][$value])) {
$i['post'][$value] = '';
}
示例6: mysql_query
mysql_query($query);
//$last_id = mysql_insert_id();
}
}
//Address Book Data Insert ---End---
//Customer Data Insert ---Start---
for($i=1;$i<=$data->sheets[0]['numRows'];$i++)
{
$customer_fname = " ";
$customer_lname = " ";
$customer_contactname = mysql_real_escape_string($data->sheets[0]['cells'][$i][3]);
$customer_email = $data->sheets[0]['cells'][$i][29];
$check_customer_email = checkMail($customer_email);
$customer_company_name = $data->sheets[0]['cells'][$i][2];
$comp_name = compName($customer_company_name);
$companyphone = $data->sheets[0]['cells'][$i][10];
$companyfax = $data->sheets[0]['cells'][$i][14];
$billing_add1 = $data->sheets[0]['cells'][$i][5];
$billing_add2 = $data->sheets[0]['cells'][$i][6];
$billing_city = $data->sheets[0]['cells'][$i][7];
$billing_state = $data->sheets[0]['cells'][$i][8];
$bill_state_val = State_Val($billing_state);
$billing_zip = $data->sheets[0]['cells'][$i][9];
$invoice_type = $data->sheets[0]['cells'][$i][18];
$billing_frequency = $data->sheets[0]['cells'][$i][19];
$account_status = $data->sheets[0]['cells'][$i][20];
$status = ($account_status == 'Y')? '1':'0';
$shipping_comp_name = " ";
示例7: addslashes
$mail = addslashes($user_cache[UID]['mail']);
$url = addslashes(BLOG_URL);
}
if ($url && strncasecmp($url, 'http', 4)) {
$url = 'http://' . $url;
}
doAction('comment_post');
if ($Comment_Model->isLogCanComment($blogId) === false) {
mMsg('评论失败:该文章已关闭评论', $targetBlogUrl);
} elseif ($Comment_Model->isCommentExist($blogId, $name, $content) === true) {
mMsg('评论失败:已存在相同内容评论', $targetBlogUrl);
} elseif ($Comment_Model->isCommentTooFast() === true) {
mMsg('评论失败:您提交评论的速度太快了,请稍后再发表评论', $targetBlogUrl);
} elseif (strlen($name) > 20 || strlen($name) == 0) {
mMsg('评论失败:姓名不符合规范', $targetBlogUrl);
} elseif ($mail != '' && !checkMail($mail)) {
mMsg('评论失败:邮件地址不符合规范', $targetBlogUrl);
} elseif (ISLOGIN == false && $Comment_Model->isNameAndMailValid($name, $mail) === false) {
mMsg('评论失败:禁止使用管理员昵称或邮箱评论', $targetBlogUrl);
} elseif (strlen($content) == '' || strlen($content) > 2000) {
mMsg('评论失败:内容不符合规范', $targetBlogUrl);
} elseif (ROLE == ROLE_VISITOR && Option::get('comment_needchinese') == 'y' && !preg_match('/[\\x{4e00}-\\x{9fa5}]/iu', $content)) {
mMsg('评论失败:评论内容需包含中文', $targetBlogUrl);
} elseif (ISLOGIN == false && Option::get('comment_code') == 'y' && session_start() && $imgcode != $_SESSION['code']) {
mMsg('评论失败:验证码错误', $targetBlogUrl);
} else {
$DB = Database::getInstance();
$ipaddr = getIp();
$utctimestamp = time();
if ($pid != 0) {
$comment = $Comment_Model->getOneComment($pid);
示例8: checkMail
$city = $_POST['city'];
$postCode = $_POST['postCode'];
if (!empty($nip) && !empty($name) && !empty($lastname) && !empty($email)) {
function checkMail($checkmail)
{
if (filter_var($checkmail, FILTER_VALIDATE_EMAIL)) {
if (checkdnsrr(array_pop(explode("@", $checkmail)), "MX")) {
return true;
} else {
return false;
}
} else {
return false;
}
}
if (checkMail($email)) {
//dodatkowe informacje: ip i host użytkownika
$ip = $_SERVER['REMOTE_ADDR'];
$host = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$mailText = "NIP:\n{$nip}\nLiczba osób:\n{$perNum}\nUlica:\n{$street}\nNumer domu:\n{$houseNumber}\nNumer mieszkania:\n{$apartmentNumber}\nPaństwo:\n{$country}\nMiasto:\n{$city}\nWojewództwo:\n{$region}\nKod pocztowy:\n{$postCode}\nOd: {$name}, {$lastname}, {$email} ({$ip}, {$host})";
$mailHeader = "Od: {$name} <{$email}>";
@mail($mojemail, 'Formularz zgłoszeniowy', $mailText, $mailHeader) or die('Błąd: formularz nie został wysłana');
echo 'Przesłane informacje:<br /> NIP: ';
echo $_POST['nip'];
echo '<br /> Imię: ';
echo $_POST['name'];
echo '<br />Nazwisko: ';
echo $_POST['lastname'];
echo '<br /> E-mail: ';
echo $_POST['email'];
echo '<br />Liczba osób: ';
示例9: checkMail
$mail->send();
}
//Mail checker
function checkMail($mail)
{
if (preg_match("/^[_\\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\\.)+[a-zA-Z]{2,6}\$/i", $mail)) {
return true;
} else {
return false;
}
}
if (isset($_POST['nombre']) && !empty($_POST['nombre']) and isset($_POST['mail']) && !empty($_POST['mail']) and isset($_POST['mensaje']) && !empty($_POST['mensaje'])) {
$mail = mysqli_real_escape_string($db, $_POST['mail']);
$nombre = mysqli_real_escape_string($db, $_POST['nombre']);
$mensaje = mysqli_real_escape_string($db, $_POST['mensaje']);
if (checkMail($mail)) {
$sql = "INSERT INTO users (`id`, `nombre`, `email`, `mensaje`) VALUES('','{$nombre}','{$mail}','{$mensaje}')";
$saveDB = mysqli_query($db, $sql);
if ($saveDB) {
MailGin($mail, $nombre, $mensaje);
echo "<div id='respuestaAjax'><script>document.getElementById('formulario').reset(); </script> \n\t\t\t\t\t\t\t<script>\n\t\t\t\t\t\t\tswal({ title: 'GRACIAS', \n\t\t\t\t\t\t\ttext: 'En breve nos comunicaremos contigo', \n\t\t\t\t\t\t\timageUrl: './img/succes.png', \n\t\t\t\t\t\t\tconfirmButtonColor: '#000'\n\t\t\t\t\t\t\t });\n\t\t\t\t\t\t \t </script></div>";
//*enviaMail($nombre,$mail,$mensaje);
//header('Location: ../thankyou.html');
} else {
echo "<div id='respuestaAjax'> \n\t\t\t\t\t\t \t<script>\n\t\t\t\t\t\t\tswal({ title: 'ERROR', \n\t\t\t\t\t\t\ttext: 'Error en base de datos', \n\t\t\t\t\t\t\timageUrl: './img/error.png', \n\t\t\t\t\t\t\tconfirmButtonColor: '#000'\n\t\t\t\t\t\t\t });\n\t\t\t\t\t\t \t </script></div>";
echo mysqli_error($db);
}
} else {
echo "<div id='respuestaAjax'> \n\t\t\t\t\t\t \t<script>\n\t\t\t\t\t\t\tswal({ title: 'ERROR', \n\t\t\t\t\t\t\ttext: 'Mail invalido', \n\t\t\t\t\t\t\timageUrl: './img/error.png', \n\t\t\t\t\t\t\tconfirmButtonColor: '#000'\n\t\t\t\t\t\t\t });\n\t\t\t\t\t\t \t </script></div>";
}
} else {
示例10: switch
switch ($_GET['do']) {
case 'register':
$registerSubmit = filter_input(INPUT_POST, 'register', FILTER_SANITIZE_STRING);
// Sicherheitsfunktionen für POST
if ($registerSubmit) {
$mail = filter_input(INPUT_POST, 'mail');
$mailConfirm = filter_input(INPUT_POST, 'mailC');
$pw = filter_input(INPUT_POST, 'password');
$pwConfirm = filter_input(INPUT_POST, 'passwordC');
$agb = filter_input(INPUT_POST, 'agb');
// Error - array
$registerErrors = [];
// check mail
if (empty($mail)) {
$registerErrors['mail'][] = 'Bitte geben Sie Ihre E-Mail Adresse an.';
} elseif (!checkMail($_POST['mail'], $db)) {
$registerErrors['mail'][] = 'Diese E-Mail Adresse wird bereits verwendet.';
}
if (!filterEmail($mail)) {
$registerErrors['mail'][] = 'Die angegebene E-Mail Adresse ist ungültig.';
}
if (empty($mailConfirm)) {
$registerErrors['mailConfirm'][] = 'Bitte bestätigen die Ihre E-Mail Adresse.';
}
if ($mail !== $mailConfirm) {
$registerErrors['mailConfirm'][] = 'Die E-Mail Adresse stimmen nicht überein.';
}
// PASSWORD
if (empty($pw)) {
$registerErrors['password'][] = 'Bitte geben Sie ein Passwort ein.';
} elseif (!filterPassword($pw)) {
示例11: dl_invite_yz
function dl_invite_yz()
{
global $m;
if (option::get('enable_reg') != '1') {
msg('注册失败:该站点已关闭注册');
}
$name = isset($_POST['user']) ? addslashes(strip_tags($_POST['user'])) : '';
$mail = isset($_POST['mail']) ? addslashes(strip_tags($_POST['mail'])) : '';
$pw = isset($_POST['pw']) ? addslashes(strip_tags($_POST['pw'])) : '';
$yr = isset($_POST['invite']) ? addslashes(strip_tags($_POST['invite'])) : '';
if (empty($name) || empty($mail) || empty($pw)) {
msg('注册失败:请正确填写账户、密码或邮箱');
}
$x = $m->once_fetch_array("SELECT COUNT(*) AS total FROM `" . DB_NAME . "`.`" . DB_PREFIX . "users` WHERE name='{$name}'");
$z = $m->once_fetch_array("SELECT COUNT(*) AS total FROM `" . DB_NAME . "`.`" . DB_PREFIX . "users` WHERE email='{$name}'");
$y = $m->once_fetch_array("SELECT COUNT(*) AS total FROM `" . DB_NAME . "`.`" . DB_PREFIX . "users`");
if ($x['total'] > 0) {
msg('注册失败:用户名已经存在');
}
if ($z['total'] > 0) {
msg('注册失败:邮箱已经存在');
}
if (!checkMail($mail)) {
msg('注册失败:邮箱格式不正确');
}
if (empty($yr)) {
msg('注册失败:请输入邀请码');
}
$invite = $m->fetch_array($m->query('select * from `' . DB_NAME . '`.`' . DB_PREFIX . 'dl_invite` where `code` = "' . $yr . '"'));
if (!empty($invite['code'])) {
$dlyr = $invite['code'];
$m->query('DELETE FROM `' . DB_NAME . '`.`' . DB_PREFIX . 'dl_invite` where `code` = "' . $dlyr . '"');
} else {
msg('注册失败:邀请码错误或已被使用');
}
if ($y['total'] <= 0) {
$role = 'admin';
} else {
$role = 'user';
}
doAction('admin_reg_2');
$m->query('INSERT INTO `' . DB_NAME . '`.`' . DB_PREFIX . 'users` (`id`, `name`, `pw`, `email`, `role`, `t`) VALUES (NULL, \'' . $name . '\', \'' . EncodePwd($pw) . '\', \'' . $mail . '\', \'' . $role . '\', \'' . getfreetable() . '\');');
setcookie("wmzz_tc_user", $name);
setcookie("wmzz_tc_pw", EncodePwd($pw));
doAction('admin_reg_3');
ReDirect('index.php');
echo '}';
die;
}
示例12: LAST_INSERT_ID
$statement->execute(array($task, $description, $ip));
$taskId = $pdo->query('SELECT LAST_INSERT_ID()')->fetchColumn();
$queryBits = array();
foreach ((array) @$_POST['label'] as $labelId) {
$queryBits[] = sprintf('(%d, %d)', $taskId, (int) $labelId);
}
// labels
if (!empty($queryBits)) {
$queryBits = implode(', ', $queryBits);
$pdo->query("INSERT INTO {$tablesPrefix}tasks_labels (task_id, label_id) VALUES {$queryBits}");
}
// notifications
$mail = trim($_POST['mail']) ?: null;
if ($mail) {
if (!checkMail($mail)) {
throw new FormException('Invalid e-mail address.');
}
$statement = $pdo->prepare("INSERT INTO {$tablesPrefix}tasks_notify (task_id, email, ipv4)\n\t\t\t\tVALUES (?, ?, ?)");
$statement->execute(array($taskId, $mail, $ip));
}
$pdo->commit();
if (!empty($notificationsEmail) && checkMail($notificationsEmail)) {
$body = $task . "\n\n" . $description . "\n\n" . sprintf('http://%s?issue=%d', $_SERVER['HTTP_HOST'] . preg_replace('/\\?.*$/', '', $_SERVER['REQUEST_URI']), $taskId) . "\n";
sendMail(sprintf('noreply@%s', $_SERVER['HTTP_HOST']), $notificationsEmail, sprintf('%sNew issue submitted', $projectTitle ? "{$projectTitle} " : ''), $body);
}
header(sprintf('Location: ?issue=%d', $taskId), null, 303);
exit;
} catch (FormException $e) {
$errorMessage = $e->getMessage();
}
}
示例13: User_Model
View::output();
}
if ($action == 'update') {
LoginAuth::checkToken();
$User_Model = new User_Model();
$photo = isset($_POST['photo']) ? addslashes(trim($_POST['photo'])) : '';
$nickname = isset($_POST['name']) ? addslashes(trim($_POST['name'])) : '';
$email = isset($_POST['email']) ? addslashes(trim($_POST['email'])) : '';
$description = isset($_POST['description']) ? addslashes(trim($_POST['description'])) : '';
$login = isset($_POST['username']) ? addslashes(trim($_POST['username'])) : '';
$newpass = isset($_POST['newpass']) ? addslashes(trim($_POST['newpass'])) : '';
$repeatpass = isset($_POST['repeatpass']) ? addslashes(trim($_POST['repeatpass'])) : '';
if (strlen($nickname) > 20) {
emDirect("./blogger.php?error_a=1");
} else {
if ($email != '' && !checkMail($email)) {
emDirect("./blogger.php?error_b=1");
} elseif (strlen($newpass) > 0 && strlen($newpass) < 6) {
emDirect("./blogger.php?error_c=1");
} elseif (!empty($newpass) && $newpass != $repeatpass) {
emDirect("./blogger.php?error_d=1");
} elseif ($User_Model->isUserExist($login, UID)) {
emDirect("./blogger.php?error_e=1");
} elseif ($User_Model->isNicknameExist($nickname, UID)) {
emDirect("./blogger.php?error_f=1");
}
}
if (!empty($newpass)) {
$PHPASS = new PasswordHash(8, true);
$newpass = $PHPASS->HashPassword($newpass);
$User_Model->updateUser(array('password' => $newpass), UID);
示例14: FormException
if ($mailAdd && $mailDismiss) {
throw new FormException('You cannot add and dismiss e-mail addresses at once.');
}
if ($mailDismiss) {
if (!checkMail($mailDismiss)) {
throw new FormException('Invalid e-mail address.');
}
$statement = $pdo->prepare("DELETE FROM {$tablesPrefix}tasks_notify WHERE task_id = ? AND email = ?");
$statement->execute(array($issueId, $mailDismiss));
$deleted = (bool) $pdo->query('SELECT ROW_COUNT()')->fetchColumn();
if (!$deleted) {
throw new FormException('No such e-mail address in database.');
}
$successMessage = 'E-mail address dismissed.';
} elseif ($mailAdd) {
if (!checkMail($mailAdd)) {
throw new FormException('Invalid e-mail address.');
}
$statement = $pdo->prepare("SELECT 1 FROM {$tablesPrefix}tasks_notify WHERE ipv4 = ? AND email = ?");
$statement->execute(array($ip, $mailAdd));
$alreadySubmitted = $statement->fetchColumn();
if (!$alreadySubmitted) {
$statement = $pdo->prepare("SELECT COUNT(DISTINCT email) FROM {$tablesPrefix}tasks_notify WHERE ipv4 = ?");
$statement->execute(array($ip));
$distinctEmails = $statement->fetchColumn();
if ($distinctEmails >= $maxEmailsSubmission) {
header(' ', null, 403);
echo 'You have submitted too many different e-mail addresses from your IP.';
exit;
}
}
示例15: phpMail
function phpMail($to, $subject, $body, $values, $mailConf)
{
// recipients
$recipients = array();
if (is_array($to)) {
foreach ($to as $key => $value) {
if (checkMail($key) == true) {
$recipients[] = $value . ' <' . $key . '>';
} elseif (checkMail($value) == true) {
$recipients[] = $value;
}
}
} else {
$recipients[] = $to;
}
$to = implode(',', $recipients);
// define charset
if (isset($values['charset'])) {
$charset = $values['charset'];
} else {
$charset = $mailConf->mail_charset;
}
if (isset($values['html_charset'])) {
$charset = $values['html_charset'];
} else {
$charset = $mailConf->mail_charset_html;
}
// bulding extra headers
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=' . $charset . "\r\n";
// sender headers
$senders = array();
if (isset($values['sender'])) {
if (is_array($values['sender'])) {
foreach ($values['sender'] as $key => $value) {
if (checkMail($key) == true) {
$senders[] = $value . ' <' . $key . '>';
} elseif (checkMail($value) == true) {
$senders[] = $value;
}
}
} else {
$senders[] = $values['sender'];
}
} elseif ($mailConf->mail_sender_mail) {
if ($mailConf->mail_sender_name) {
$senders[] = $mailConf->mail_sender_name . ' <' . $mailConf->mail_sender_mail . ">";
} else {
$senders[] = $mailConf->mail_sender_mail;
}
}
if (sizeof($senders) > 0) {
$tmp = implode(',', $senders);
$headers .= "From: " . $tmp . "\r\n";
}
// copy headers
$cc = array();
if (isset($values['cc'])) {
if (is_array($values['cc'])) {
foreach ($values['cc'] as $key => $value) {
if (checkMail($key) == true) {
$cc[] = $value . ' <' . $key . '>';
} elseif (checkMail($value) == true) {
$cc[] = $value;
}
}
} else {
$cc[] = $values['cc'];
}
}
if (sizeof($cc) > 0) {
$tmp = implode(',', $cc);
$headers .= "Cc: " . $tmp . "\r\n";
}
// hidden copy headers
$cc = array();
if (isset($values['bcc'])) {
if (is_array($values['bcc'])) {
foreach ($values['bcc'] as $key => $value) {
if (checkMail($key) == true) {
$cc[] = $value . ' <' . $key . '>';
} elseif (checkMail($value) == true) {
$cc[] = $value;
}
}
} else {
$cc[] = $values['bcc'];
}
}
if (sizeof($cc) > 0) {
$tmp = implode(',', $cc);
$headers .= "Bcc: " . $tmp . "\r\n";
}
// send email
$result = mail($to, $subject, $body, $headers);
if ($result == null) {
return false;
} else {
return true;
}
//.........这里部分代码省略.........