本文整理汇总了PHP中CheckEmail函数的典型用法代码示例。如果您正苦于以下问题:PHP CheckEmail函数的具体用法?PHP CheckEmail怎么用?PHP CheckEmail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CheckEmail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SendEmail
function SendEmail($email_to, $subject, $message)
{
if (!CheckEmail($email_to)) {
return false;
}
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: BIS<bis@hunze.nl>\r\n";
$startbody = "<html><head><title></title></head><body><font face=\"Arial\" size=\"2\"><p>";
$endbody = "</p></font></body></html>";
mail($email_to, $subject, $startbody . $message . $endbody, $headers);
return true;
}
示例2: getApi
function getApi($api)
{
$data = new stdClass();
if ($api == 'send') {
$errors = array();
$sender_name = Request('sender_name');
$sender_email = CheckEmail(Request('sender_email')) == true ? Request('sender_email') : ($errors['sender_email'] = $this->getLanguage('error/sender'));
$reply_name = Request('reply_name');
$reply_email = CheckEmail(Request('reply_email')) == true ? Request('reply_email') : null;
$bcc_name = Request('bcc_name');
$bcc_email = CheckEmail(Request('bcc_email')) == true ? Request('bcc_email') : null;
$receiver_name = Request('receiver_name');
$receiver_email = CheckEmail(Request('receiver_email')) == true ? Request('receiver_email') : ($errors['receiver_email'] = $this->getLanguage('error/receiver'));
$subject = Request('subject') ? Request('subject') : ($errors['subject'] = $this->getLanguage('error/subject'));
$content = Request('content') ? Request('content') : ($errors['content'] = $this->getLanguage('error/content'));
$isHtml = Request('is_html') == 'true';
if (count($errors) == 0) {
$this->setFrom($sender_email, $sender_name);
$this->addTo($receiver_email, $receiver_name);
$this->setSubject($subject);
$this->setContent($content, $isHtml);
if ($reply_email == null) {
$reply_email = $sender_email;
$reply_name = $sender_name;
}
$this->setReplyTo($reply_email, $reply_name);
if ($bcc_email !== null) {
$this->addBcc($bcc_email, $bcc_name);
}
$this->send();
$data->success = true;
$data->message = $this->getLanguage('success');
} else {
$data->success = false;
$data->errors = $errors;
}
}
return $data;
}
示例3: elseif
if ($ucresult > 0) {
echo "<font color='#4E7504'><b>√可以使用</b></font>";
} elseif ($ucresult == -4) {
echo "<font color='red'><b>×Email 格式有误!</b></font>";
} elseif ($ucresult == -5) {
echo "<font color='red'><b>×Email 不允许注册!</b></font>";
} elseif ($ucresult == -6) {
echo "<font color='red'><b>×该 Email 已经被注册!</b></font>";
}
exit;
}
#/aip}}
if ($cfg_md_mailtest == 'N') {
$msg = "<font color='#4E7504'><b>√可以使用</b></font>";
} else {
if (!CheckEmail($email)) {
$msg = "<font color='#4E7504'><b>×Email格式有误</b></font>";
} else {
$row = $dsql->GetOne("SELECT mid FROM `#@__member` WHERE email LIKE '{$email}' LIMIT 1");
if (!is_array($row)) {
$msg = "<font color='#4E7504'><b>√可以使用</b></font>";
} else {
$msg = "<font color='red'><b>×Email已经被另一个帐号占用!</b></font>";
}
}
}
echo $msg;
exit;
} else {
if ($dopost == "regnew") {
$step = empty($step) ? 1 : intval(preg_replace("/[^\\d]/", '', $step));
示例4: SavePost
public function SavePost($ObjectId, $Edit = false)
{
$errors = array();
if ($Edit) {
if (!isset($_GET['post_id'])) {
$errors[] = 'post_id не инициализирована в GET.';
} else {
$post_id = SafeEnv($_GET['post_id'], 11, int);
System::database()->Select($this->PostsTable, "`id`='{$post_id}'");
$post = System::database()->FetchRow();
}
} else {
if (!$this->AlloyComments) {
$errors[] = 'Обсуждение закрыто';
return;
}
if ($this->DisableComments) {
$errors[] = 'Система комментариев отключена. Вы не сможете добавить комментарий.';
}
}
$post_message = '';
$post_parent_id = 0;
if (System::user()->Auth) {
// Авторизованный пользователь, добавляет комментарий
if (!isset($_POST['post_message']) || !isset($_POST['parent_id'])) {
$errors[] = 'Данные не инициализированы.';
}
$user_id = System::user()->Get('u_id');
$user_name = System::user()->Get('u_name');
$user_email = System::user()->Get('u_email');
$user_hideemail = System::user()->Get('u_hideemail');
$user_homepage = System::user()->Get('u_homepage');
if ($Edit && !System::user()->isAdmin() && $post['user_id'] != System::user()->Get('u_id')) {
$errors[] = 'У вас недостаточно прав для редактирования этого сообщения.';
}
} else {
// Гость, добавляет или редактирует комментарий
if ($Edit && ($post['user_id'] != '0' || $post['user_ip'] != getip())) {
$errors[] = 'У вас недостаточно прав для редактирования этого сообщения.';
} else {
if ($this->GuestPost || $Edit) {
// Разрешено комментировать гостям?
if (!$Edit) {
if (!isset($_POST['user_name']) || !isset($_POST['user_email']) || !isset($_POST['user_homepage']) || !isset($_POST['post_message']) || !isset($_POST['parent_id'])) {
$errors[] = 'Данные не инициализированы.';
} else {
$user_id = 0;
$user_name = SafeEnv($_POST['user_name'], 255, str, true);
CheckNikname($user_name, $er, true);
System::user()->Def('u_name', $user_name);
$user_email = SafeEnv($_POST['user_email'], 255, str, true);
if ($user_email != '') {
if (!CheckEmail($user_email)) {
$errors[] = 'Формат E-mail не правильный. Он должен быть вида: <b>domain@host.ru</b> .';
}
}
System::user()->Def('u_email', $user_email);
if (isset($_POST['hideemail'])) {
$user_hideemail = '1';
} else {
$user_hideemail = '0';
}
System::user()->Def('u_hideemail', $user_hideemail);
$user_homepage = Url(SafeEnv($_POST['user_homepage'], 250, str, true));
System::user()->Def('u_homepage', $user_homepage);
}
} else {
if (!isset($_POST['post_message']) || !isset($_POST['parent_id'])) {
$errors[] = 'Данные не инициализированы.';
}
$user_id = SafeDB($post['user_id'], 11, int);
$user_name = SafeDB($post['user_name'], 255, str);
$user_email = SafeDB($post['user_email'], 255, str);
$user_hideemail = SafeDB($post['user_hideemail'], 1, int);
$user_homepage = SafeDB($post['user_homepage'], 255, str);
}
} else {
$errors[] = 'Чтобы оставлять сообщения, вам необходимо зарегистрироваться.';
}
}
}
if ($user_name == '') {
$errors[] = 'Вы не ввели имя.';
}
if ($user_email == '') {
$errors[] = 'Вы не указали ваш E-mail.';
}
$post_message = SafeEnv($_POST['post_message'], $this->PostMaxLength, str);
if (strlen($post_message) == 0) {
$errors[] = 'Вы не ввели текст сообщения.';
}
// Проверяем капчу
if (!System::user()->Auth || !System::user()->isAdmin() && $this->ShowKaptchaForMembers) {
if (!System::user()->isDef('captcha_keystring') || System::user()->Get('captcha_keystring') != $_POST['keystr']) {
$errors[] = 'Вы ошиблись при вводе кода с картинки.';
}
}
if (!isset($_POST['parent_id'])) {
$errors[] = 'parent_id не инициализирована в POST.';
} else {
//.........这里部分代码省略.........
示例5: doProcess
function doProcess($action)
{
$results = new stdClass();
$values = new stdClass();
if ($action == 'check') {
$name = Request('name');
$value = Request('value');
if ($name == 'email') {
if (CheckEmail($value) == true) {
if ($this->db()->select($this->table->member)->where('email', $value)->has() == true) {
$results->success = false;
$results->message = $this->getLanguage('signup/help/email/duplicated');
} else {
$results->success = true;
}
} else {
$results->success = false;
$results->message = $this->getLanguage('signup/help/email/error');
}
}
if ($name == 'name') {
if (strlen($value) > 0) {
$results->success = true;
} else {
$results->success = false;
$results->message = $this->getLanguage('signup/help/name/error');
}
}
if ($name == 'nickname') {
if (CheckNickname($value) == true) {
if ($this->db()->select($this->table->member)->where('nickname', $value)->where('idx', $this->getLogged(), '!=')->has() == true) {
$results->success = false;
$results->message = $this->getLanguage('signup/help/nickname/duplicated');
} else {
$results->success = true;
}
} else {
$results->success = false;
$results->message = $this->getLanguage('signup/help/nickname/error');
}
}
if ($name == 'old_password') {
if ($this->isLogged() == false) {
$results->success = false;
$results->message = $this->getLanguage('error/notLogged');
} else {
$mHash = new Hash();
if ($mHash->password_validate($value, $this->getMember()->password) == true) {
$results->success = true;
$results->message = $this->getLanguage('password/help/old_password/success');
} else {
$results->success = false;
$results->message = $this->getLanguage('password/help/old_password/error');
}
}
}
}
if ($action == 'forceLogin') {
$code = Decoder(Request('code'));
if ($code === false) {
$results->success = false;
$results->message = $this->getLanguage('error/invalidCode');
} else {
$data = json_decode($code);
if ($data != null && $data->ip == $_SERVER['REMOTE_ADDR']) {
$this->login($data->idx);
$results->success = true;
} else {
$results->success = false;
$results->message = $this->getLanguage('error/invalidCode');
}
}
}
if ($action == 'login') {
$mHash = new Hash();
$email = Request('email');
$password = Request('password');
$results->errors = array();
$loginFail = Request('loginFail', 'session') != null && is_array(Request('loginFail', 'session')) == true ? Request('loginFail', 'session') : array('count' => 0, 'time' => 0);
if ($loginFail['time'] > time()) {
$results->success = false;
$results->message = $this->getLanguage('login/error/login');
} else {
$check = $this->db()->select($this->table->member)->where('email', $email)->getOne();
if ($check == null) {
$results->success = false;
$results->errors['email'] = $this->getLanguage('login/error/email');
$loginFail['count']++;
if ($loginFail['count'] == 5) {
$loginFail['count'] = 0;
$loginFail['time'] = time() + 60 * 60 * 5;
}
$values->email = $email;
$values->password = $password;
} elseif ($mHash->password_validate($password, $check->password) == false) {
$results->success = false;
$results->errors['password'] = $this->getLanguage('login/error/password');
$loginFail['count']++;
if ($loginFail['count'] == 5) {
$loginFail['count'] = 0;
//.........这里部分代码省略.........
示例6: AdminUserEditSave
/**
* Сохраняет данные формы сгенерированной фукцией AdminUserEditor
*
* @param $back_link
* @param string $a
* @param int $id
* @param bool $IsAdmin
* @return void
*/
function AdminUserEditSave($back_link, $a = 'insert', $id = 0, $IsAdmin = false)
{
$SystemAdmin = System::user()->isSuperUser();
$edit = $a == 'update';
$editProfile = $edit && !$SystemAdmin && $id == System::user()->Get('u_id');
// Администратор редактирует свой профиль
$editStatus = false;
// Разрешено редактирование статуса
$editType = false;
// Разрешено редактировать тип пользователя
// Загружаем данные пользователя из БД
if ($edit) {
$user = System::database()->SelectOne('users', "`id`='{$id}'" . ($IsAdmin ? " and `type`='1'" : " and `type`='2'"));
if (!$user) {
AddTextBox('Ошибка', '<p align="center">Пользователь не найден, либо у вас не достаточно прав для редактирования администраторов.</p>');
return;
}
}
// Устанавливаем ограничения доступа
if ($IsAdmin) {
// Редактируем администратора
if ($SystemAdmin) {
// Только системные администраторы могут редактировать статус и тип администраторов
if (!$edit) {
$editStatus = true;
} elseif (!(groupIsSystem(SafeEnv($user['access'], 11, int)) && GetSystemAdminsCount() <= 1)) {
// Если он не системный или системных больше 1
$editStatus = true;
}
$editType = $editStatus;
}
} else {
// Если пользователь
$editStatus = true;
// Все администраторы с доступом могут редактировать статус пользователя
$editType = $SystemAdmin;
// Только системные администраторы могут создавать администраторов
}
// Обрабатываем данные
$errors = array();
// Логин
if (isset($_POST['login']) && CheckLogin($_POST['login'], $errors, !$edit)) {
$login = SafeEnv($_POST['login'], 30, str);
} else {
$login = '';
}
// Пароль
$pass = '';
if (!$edit || $_POST['pass'] != '') {
$pass_generate_message = '';
if (isset($_POST['pass']) && CheckPass($_POST['pass'], $errors)) {
$pass = SafeEnv($_POST['pass'], 30, str);
if (!isset($_POST['rpass']) || SafeEnv($_POST['rpass'], 30, str) != $pass) {
$errors[] = 'Пароли не совпадают.';
}
} else {
$pass = '';
}
if (isset($_POST['pass']) && $_POST['pass'] == '') {
srand(time());
$pass = GenBPass(rand(System::config('user/pass_min_length'), 15));
$pass_generate_message = '<br />Так как вы не указали пароль, он был сгенерирован автоматически и выслан на указанный E-mail пользователя.';
}
$pass2 = md5($pass);
}
// e-mail
if (isset($_POST['email']) && $_POST['email'] != '') {
if (!CheckEmail($_POST['email'])) {
$errors[] = 'Не правильный формат E-mail. Он должен быть вида: <b>domain@host.ru</b> .';
}
$email = SafeEnv($_POST['email'], 50, str, true);
} else {
$email = '';
$errors[] = 'Вы не ввели E-mail.';
}
// Скрыть e-mail
if (isset($_POST['hideemail'])) {
$hide_email = '1';
} else {
$hide_email = '0';
}
// Имя пользователя на сайте
if (isset($_POST['nikname']) && CheckNikname($_POST['nikname'], $errors, !$edit)) {
$nik_name = SafeEnv($_POST['nikname'], 50, str, true);
} else {
$nik_name = '';
}
// Полное имя
if (isset($_POST['realname'])) {
$real_name = SafeEnv($_POST['realname'], 250, str, true);
} else {
//.........这里部分代码省略.........
示例7: apostrof
if (isset($_POST['insert'])) {
$name = $_POST['name'];
$grade = $_POST['grade'];
$age = $_POST['age'];
$email = $_POST['email'];
$telph = $_POST['telph'];
if (!CheckName($name)) {
$fail_msg_name = "U dient een geldige voor- en achternaam op te geven. Let op: de apostrof (') wordt niet geaccepteerd.";
}
if (!$telph && !$email) {
$fail_msg_contact = "U dient of een telefoonnummer, of een e-mailadres in te vullen.";
} else {
if ($telph && !check_phone_dutch($telph)) {
$fail_msg_telph = "U dient een 10-cijferig telefoonnummer met streepje in te vullen.";
}
if ($email && !CheckEmail($email)) {
$fail_msg_email = "U dient een geldig e-mailadres in te voeren.";
}
}
if (isset($fail_msg_name) || isset($fail_msg_contact) || isset($fail_msg_telph) || isset($fail_msg_email)) {
$fail = true;
}
if (!isset($fail) || $fail == false) {
$hash = 0;
while ($hash == 0) {
$hash = generateHash();
}
$query = "INSERT INTO `examen_inschrijvingen` (Naam, Graad, Leeftijd, Ex_ID, Email, TelNr, UniekeHash) VALUES ('{$name}', '{$grade}', '{$age}', '{$id}', '{$email}', '{$telph}', '{$hash}');";
$result = mysql_query($query);
if (!$result) {
die("Inschrijven voor examen mislukt." . mysql_error());
示例8: DoStripSlashes
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$clientIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$clientIP = $_SERVER['REMOTE_ADDR'];
}
$FTGname = DoStripSlashes($_REQUEST['name']);
$FTGemail = DoStripSlashes($_REQUEST['email']);
$FTGmessage = DoStripSlashes($_REQUEST['message']);
$FTGsubmit = DoStripSlashes($_REQUEST['submit']);
$validationFailed = false;
# Fields Validations
if (!CheckString($FTGname, 2, 0, kStringRangeFrom, kNo, kNo, kNo, '', kMandatory)) {
$FTGErrorMessage['name'] = 'Please insert a valid name';
$validationFailed = true;
}
if (!CheckEmail($FTGemail, kMandatory)) {
$FTGErrorMessage['email'] = 'Please insert a valid email address';
$validationFailed = true;
}
if (!CheckString($FTGmessage, 10, 0, kStringRangeFrom, kNo, kNo, kNo, '', kMandatory)) {
$FTGErrorMessage['message'] = 'This field is required';
$validationFailed = true;
}
# Include message in error page and dump it to the browser
if ($validationFailed === true) {
$errorPage = '<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><title>Error</title></head><body><div id="errors" class="padd">Errors found: <!--VALIDATIONERROR--></div></body></html>';
$errorPage = str_replace('<!--FIELDVALUE:name-->', $FTGname, $errorPage);
$errorPage = str_replace('<!--FIELDVALUE:email-->', $FTGemail, $errorPage);
$errorPage = str_replace('<!--FIELDVALUE:message-->', $FTGmessage, $errorPage);
$errorPage = str_replace('<!--FIELDVALUE:submit-->', $FTGsubmit, $errorPage);
$errorPage = str_replace('<!--ERRORMSG:name-->', $FTGErrorMessage['name'], $errorPage);
示例9: unset
$_SESSION['changyan'] = 0;
$_SESSION['user'] = '';
unset($_SESSION['changyan']);
unset($_SESSION['user']);
if ($nomsg) {
header('Location:?forward=' . $forward);
exit;
} else {
changyan_set_setting('pwd', '');
}
ShowMsg("成功退出畅言!", '?');
exit;
} elseif ($dopost == 'forget-pwd') {
if ($action == 'do') {
$user = empty($user) ? '' : $user;
if (empty($user) and !CheckEmail($user)) {
ShowMsg("请填写正确格式的E-mail!", -1);
exit;
}
$error_msg = '';
if (changyan_forget_pwd($user, $error_msg)) {
ShowMsg("<p>成功发送密码找回邮件,请登录[{$user}]查收!</p><p><a href='?' >返回上一页</a></p>", 'javascript:;');
} else {
ShowMsg("密码找回错误:{$error_msg}!", -1);
}
exit;
}
$user = changyan_get_setting('user');
$msg = <<<EOT
<html>
<head>
示例10: doProcess
function doProcess($action)
{
$results = new stdClass();
$values = new stdClass();
if ($action == 'check') {
$name = Request('name');
$value = Request('value');
if ($name == 'email') {
$siteType = $this->IM->getSites($this->IM->domain)->member;
if (CheckEmail($value) == true) {
if ($this->db()->select($this->table->member)->where('email', $value)->where('idx', $this->getLogged(), '!=')->where('domain', $siteType == 'MERGE' ? '*' : $this->IM->domain)->has() == true || $this->db()->select($this->table->member)->where('email', $value)->where('idx', $this->getLogged(), '!=')->where('type', 'ADMINISTRATOR')->has() == true) {
$results->success = false;
$results->message = $this->getLanguage('signup/help/email/duplicated');
} else {
$results->success = true;
}
} else {
$results->success = false;
$results->message = $this->getLanguage('signup/help/email/error');
}
}
if ($name == 'name') {
if (strlen($value) > 0) {
$results->success = true;
} else {
$results->success = false;
$results->message = $this->getLanguage('signup/help/name/error');
}
}
if ($name == 'nickname') {
$siteType = $this->IM->getSites($this->IM->domain)->member;
if (CheckNickname($value) == true) {
if ($this->db()->select($this->table->member)->where('nickname', $value)->where('idx', $this->getLogged(), '!=')->where('domain', $siteType == 'MERGE' ? '*' : $this->IM->domain)->has() == true || $this->db()->select($this->table->member)->where('nickname', $value)->where('idx', $this->getLogged(), '!=')->where('type', 'ADMINISTRATOR')->has() == true) {
$results->success = false;
$results->message = $this->getLanguage('signup/help/nickname/duplicated');
} else {
$results->success = true;
}
} else {
$results->success = false;
$results->message = $this->getLanguage('signup/help/nickname/error');
}
}
if ($name == 'old_password') {
if ($this->isLogged() == false) {
$results->success = false;
$results->message = $this->getLanguage('error/notLogged');
} else {
$mHash = new Hash();
if ($mHash->password_validate($value, $this->getMember()->password) == true) {
$results->success = true;
$results->message = $this->getLanguage('password/help/old_password/success');
} else {
$results->success = false;
$results->message = $this->getLanguage('password/help/old_password/error');
}
}
}
}
if ($action == 'forceLogin') {
$code = Decoder(Request('code'));
if ($code === false) {
$results->success = false;
$results->message = $this->getLanguage('error/invalidCode');
} else {
$data = json_decode($code);
if ($data != null && $data->ip == $_SERVER['REMOTE_ADDR']) {
$this->login($data->idx);
$results->success = true;
} else {
$results->success = false;
$results->message = $this->getLanguage('error/invalidCode');
}
}
}
if ($action == 'login') {
$mHash = new Hash();
$email = Request('email');
$password = Request('password');
$results->errors = array();
$loginFail = Request('loginFail', 'session') != null && is_array(Request('loginFail', 'session')) == true ? Request('loginFail', 'session') : array('count' => 0, 'time' => 0);
if ($loginFail['time'] > time()) {
$results->success = false;
$results->message = $this->getLanguage('login/error/login');
} else {
$siteType = $this->IM->getSites($this->IM->domain)->member;
if ($siteType == 'MERGE') {
$check = $this->db()->select($this->table->member)->where('email', $email)->where('domain', '*')->getOne();
} else {
$check = $this->db()->select($this->table->member)->where('email', $email)->where('domain', $this->IM->domain)->getOne();
}
// not found member, search ADMINISTRATOR
if ($check == null) {
$check = $this->db()->select($this->table->member)->where('email', $email)->where('type', 'ADMINISTRATOR')->getOne();
}
if ($check == null) {
$results->success = false;
$results->errors['email'] = $this->getLanguage('login/error/email');
$loginFail['count']++;
if ($loginFail['count'] == 5) {
//.........这里部分代码省略.........
示例11: Ufu
System::site()->AddTemplatedBox('Рассылки', 'module/mail.html');
System::site()->AddBlock('mail');
$vars['message'] = $message;
$vars['form_action'] = Ufu('index.php?name=mail&op=topics', 'mail/{op}/');
$vars['lemail'] = 'Ваш e-mail';
$vars['lsubmit'] = 'Далее';
System::site()->Blocks['mail']['vars'] = $vars;
}
if (isset($_POST['mail_block_form'])) {
System::user()->UnDef('mail_selected');
}
global $mail_selected;
if (!IndexMailIsSelected()) {
if (isset($_POST['mail_form']) || isset($_POST['mail_block_form'])) {
$mail_selected = SafeEnv($_POST['email'], 50, str);
if (!CheckEmail($mail_selected)) {
IndexMailEnterMail('E-mail указан в неверном формате.');
return;
} elseif (MailIsSetEmail($mail_selected)) {
System::site()->Login('Адрес <b>' . $mail_selected . '</b> уже используется, пожалуйста авторизируйтесь.');
return;
} else {
System::user()->Def('mail_selected', $mail_selected);
}
} elseif (System::user()->Auth && System::user()->Get('u_email') != '') {
$mail_selected = System::user()->Get('u_email');
System::user()->Def('mail_selected', $mail_selected);
} else {
IndexMailEnterMail();
System::site()->Login();
return;
示例12: array
case 2:
$errors = array();
$admin_login = $_POST['login'];
$admin_pass = $_POST['pass'];
$admin_email = $_POST['email'];
// Сохраняем данные в сессии
System::user()->Session('admin_login', $admin_login);
System::user()->Session('admin_pass', $admin_pass);
System::user()->Session('admin_email', $admin_email);
// Проверки
CheckLogin($admin_login, $errors, false, 0);
CheckPass($admin_pass, $errors);
// Email
if ($admin_email == '') {
$errors[] = 'Вы не ввели E-mail.';
} elseif (!CheckEmail($admin_email)) {
$errors[] = 'Формат E-mail не правильный. Он должен быть вида: <b>domain@host.ru</b> .';
}
if (count($errors) > 0) {
$this->SetTitle("Создание учетной записи Главного администратора");
$text = 'Ошибки:<br /><ul>';
foreach ($errors as $error) {
$text .= '<li>' . $error;
}
$text .= '</ul>';
$this->SetContent($text);
$this->AddButton('Назад', 'admin&p=1');
} else {
// Изменяем главного администратора
$login = SafeEnv($admin_login, 255, str);
$pass2 = md5($admin_pass);
示例13: AdminMailAddEmail
function AdminMailAddEmail()
{
if (!isset($_GET['topic_id'])) {
GO(ADMIN_FILE . '?exe=mail');
}
$topic_id = SafeEnv($_GET['topic_id'], 11, int);
if (!isset($_POST['email'])) {
GO(ADMIN_FILE . '?exe=mail');
}
if (CheckEmail($_POST['email'])) {
$email = SafeEnv($_POST['email'], 50, str, true);
} else {
$text = 'Не правильный формат E-mail. Он должен быть вида: <b>domain@host.ru</b>.<br />' . '<a href="javascript:history.go(-1)">Назад</a>';
AddTextBox("Внимание!", $text);
return;
}
System::database()->Select('mail_topics', "`id`='{$topic_id}'");
$topic = System::database()->FetchRow();
$html = SafeEnv($_POST['html'], 1, int);
$vals = Values('0', $topic_id, $email, $html);
System::database()->Insert('mail_list', $vals);
Audit('Рассылки: Добавление адреса ' . $email . ' в список рассылки темы "' . $topic['title'] . '"');
CalcListCounter($topic_id, true);
GO(ADMIN_FILE . '?exe=mail&a=list&topic_id=' . $topic_id);
}
示例14: makeReservation
function makeReservation($id, $boat_id, $name, $team_name, $email, $mpb, $date, $start_time_hrs, $start_time_mins, $end_time_hrs, $end_time_mins, $ergo_lo = 0, $ergo_hi = 0)
{
global $database_host;
global $database_user;
global $database_pass;
global $database;
global $opzoektabel;
global $koudwaterprotocol;
global $today_db;
global $thehour;
global $theminute;
global $themonth;
$NR_OF_CONCEPTS = 8;
// LET OP: aanpassen als het aantal Concept-ergo's verandert! (ivm blokinschrijving)
$bisdblink = mysql_connect($database_host, $database_user, $database_pass);
if (!mysql_select_db($database, $bisdblink)) {
$messages[] = "Fout: database niet gevonden.";
$returnArray = array("success" => false, "messages" => $messages);
return $returnArray;
}
$messages = array();
// check persoonsnaam
if (!CheckName($name)) {
$messages[] = "• U dient een geldige voor- en achternaam op te geven. Let op: de apostrof (') wordt niet geaccepteerd.";
}
// email is niet verplicht, maar moet wel correct zijn
if ($email && !CheckEmail($email)) {
$messages[] = "• U dient een geldig e-mailadres op te geven.";
}
// check date
$date_db = 0;
if (!$date || !CheckTheDate($date) || $mpb != "Societeit" && !InRange($date, 10)) {
$messages[] = "• U dient een (geldige) inschrijfdatum op te geven, van vandaag tot over maximaal 10 dagen.";
} else {
$date_db = DateToDBdate($date);
if (strtotime($date_db) < strtotime($today_db)) {
$messages[] = "Een inschrijving kan niet in het verleden plaatsvinden.";
}
}
// check time
if (!is_numeric($start_time_hrs) || $start_time_hrs < 6 || $start_time_hrs > 23) {
$messages[] = "Ongeldig start-uur.";
}
if (!is_numeric($end_time_hrs) || $end_time_hrs < 6 || $end_time_hrs > 23) {
$messages[] = "Ongeldig eind-uur.";
}
if ($start_time_mins != "00" && $start_time_mins != "0" && $start_time_mins != "15" && $start_time_mins != "30" && $start_time_mins != "45") {
$messages[] = "Ongeldige start-minuten.";
}
if ($end_time_mins != "00" && $end_time_mins != "0" && $end_time_mins != "15" && $end_time_mins != "30" && $end_time_mins != "45") {
$messages[] = "Ongeldige eind-minuten.";
}
$start_time = $start_time_hrs . ":" . $start_time_mins;
$end_time = $end_time_hrs . ":" . $end_time_mins;
$duration = ($end_time_hrs - $start_time_hrs) * 60 + ($end_time_mins - $start_time_mins);
if ($duration <= 0) {
$messages[] = "De eindtijd van een inschrijving dient later dan de begintijd te zijn.";
}
if ($date_db == $today_db && ($start_time_hrs < $thehour || $start_time_hrs == $thehour && $start_time_mins < $theminute)) {
$messages[] = "Een inschrijving kan niet in het verleden beginnen.";
}
// check ergo-blok
if (!is_numeric($ergo_lo) || !is_numeric($ergo_hi) || $ergo_lo < 0 || $ergo_lo > $NR_OF_CONCEPTS || $ergo_hi < 0 || $ergo_hi > $NR_OF_CONCEPTS) {
$messages[] = "Nummering van de Concept-ergometers klopt niet.";
}
$ergo_range = $ergo_hi - $ergo_lo;
if ($ergo_range < 0) {
$messages[] = "Het blok moet lopen van de laagst- t/m de hoogst-genummerde Concept-ergometer.";
$ergo_lo = 0;
$ergo_hi = 0;
}
// check boat
if (!is_numeric($boat_id) || $boat_id == 0) {
$boat = "";
$messages[] = "U heeft geen boot geselecteerd.";
} else {
$query_bootnaam = "SELECT Naam FROM boten WHERE ID={$boat_id};";
$result_bootnaam = mysql_query($query_bootnaam);
$row_bootnaam = mysql_fetch_assoc($result_bootnaam);
$boat = $row_bootnaam['Naam'];
}
// cat. & grade bepalen n.a.v. boot die wordt ingeschreven
$query = "SELECT Roeigraad, `Type` FROM boten WHERE ID='" . $boat_id . "';";
$result = mysql_query($query);
if ($result) {
$row = mysql_fetch_assoc($result);
$grade = $row['Roeigraad'];
$type = $row['Type'];
$query2 = "SELECT Categorie FROM types WHERE `Type`='" . $type . "';";
$result2 = mysql_query($query2);
if ($result2) {
$row2 = mysql_fetch_assoc($result2);
$cat = $row2['Categorie'];
}
}
// check op uit de vaart
$query = "SELECT * \r\t\tFROM uitdevaart \r\t\tWHERE Verwijderd=0 \r\t\tAND Boot_ID='{$boat_id}' \r\t\tAND Startdatum<='{$date_db}' \r\t\tAND (Einddatum='0' OR Einddatum='0000-00-00' OR Einddatum IS NULL OR Einddatum>='{$date_db}');";
$result = mysql_query($query);
if (!$result) {
$messages[] = "Ophalen van uit de vaart-informatie mislukt.";
//.........这里部分代码省略.........
示例15: IndexGBAddMsgSave
function IndexGBAddMsgSave()
{
$r = array();
$er = array();
if (!isset($_GET['name']) || !isset($_POST['email']) || !isset($_POST['site']) || !isset($_POST['icq']) || !isset($_POST['text'])) {
$er[] = 'Данные не инициализированы.';
}
if (GBCheckFlood()) {
$er[] = 'Флуд защита, подождите немного.';
}
if (strlen($_POST['name']) == 0) {
$er[] = 'Вы не ввели имя.';
}
if (strlen($_POST['email']) == 0) {
$er[] = 'Вы не ввели свой e-mail.';
} elseif (!CheckEmail($_POST['email'])) {
$er[] = 'Вы совершили ошибку при вводе e-mail.';
}
if (strlen($_POST['text']) == 0) {
$er[] = 'Вы не ввели текст сообщения, либо сообщение слишком короткое.';
}
if ($_POST['icq'] != '') {
if (!is_numeric($_POST['icq'])) {
$er[] = 'Ваш номер ICQ должен состоять только из чисел.';
}
}
// Проверяем капчу
if (!System::user()->Auth || !System::user()->isAdmin() && System::config('gb/show_captcha')) {
if (!System::user()->isDef('captcha_keystring') || System::user()->Get('captcha_keystring') != $_POST['keystr']) {
$er[] = 'Вы ошиблись при вводе кода с картинки.';
}
}
if (count($er) == 0) {
if (isset($_POST['hideemail'])) {
$hideemail = '1';
} else {
$hideemail = '0';
}
if (System::user()->isAdmin() || !System::config('gb/moderation')) {
$moderated = 1;
} else {
$moderated = 0;
}
$name = SafeEnv($_POST['name'], 50, str, true);
$email = SafeEnv($_POST['email'], 50, str, true);
$_site = SafeEnv(Url($_POST['site']), 250, str, true);
$icq = SafeEnv($_POST['icq'], 15, str, true);
$text = SafeEnv($_POST['text'], System::config('gb/msgmaxlen'), str, true);
$vals = Values('', $name, $email, $hideemail, $_site, $icq, $text, '', time(), getip(), $moderated);
System::database()->Insert('guestbook', $vals);
System::user()->ChargePoints(System::config('points/gb_public'));
if (System::user()->isAdmin() || !System::config('gb/moderation')) {
GO(GetSiteUrl() . Ufu('index.php?name=guestbook', '{name}/'));
} else {
$text = '<p align="center"><br>Спасибо! Ваше сообщение будет добавлено после модерации.<br><br>';
$text .= '<input type="button" value="Назад" onclick="history.back();"><br></p>';
System::site()->AddTextBox('', $text);
}
} else {
$text = 'Ваше сообщение не добавлено по следующим причинам:<br><ul>';
foreach ($er as $error) {
$text .= '<li>' . $error;
}
$text .= '</ul><p align="center"><input type="button" value="Назад" onclick="history.back();"></p>';
System::site()->AddTextBox('', $text);
}
}