function check_parameters_mail($type, $mail_sender, $name_sender, $mail_receiver, $subject, $message)
{
    $error = '';
    // Check sender's name
    if ($type == 'contact' && !$name_sender) {
        $error .= 'Vous devez entrer un nom.<br />';
    }
    // Check sender's email
    if (!$mail_sender) {
        $error .= 'Vous devez entrer une adresse mail pour l\'exp&eacute;diteur.<br />';
    }
    if ($mail_sender && !ValidateEmail($mail_sender)) {
        $error .= 'L\'adresse mail de l\'exp&eacute;diteur n\'est pas valide.<br />';
    }
    // Check the receiver's email
    if (!$mail_receiver) {
        $error .= 'Vous devez entrer une adresse mail pour le destinataire.<br />';
    }
    if ($mail_receiver && !ValidateEmail($mail_receiver)) {
        $error .= 'L\'adresse mail du destinaire n\'est pas valide.<br />';
    }
    // Check message (length)
    if ($type == 'contact' && (!$message || strlen($message) < 10)) {
        $error .= "Veuillez entrer un message. Il doit faire au minimum 10 caract&egrave;res.<br />";
    }
    return $error;
}
function check_parameters_mail($type, $mail_sender, $name_sender, $mail_receiver, $subject, $messagebody)
{
    $message['message'] = '';
    $message['class'] = 'danger';
    // Check sender's name
    if ($type == 'contact' && !$name_sender) {
        $message['message'] .= _t('CONTACT_ENTER_NAME') . '<br />';
    }
    // Check sender's email
    if (!$mail_sender) {
        $message['message'] .= _t('CONTACT_ENTER_SENDER_MAIL') . '<br />';
    }
    if ($mail_sender && !ValidateEmail($mail_sender)) {
        $message['message'] .= _t('CONTACT_SENDER_MAIL_INVALID') . '<br />';
    }
    // Check the receiver's email
    if (!$mail_receiver) {
        $message['message'] .= _t('CONTACT_ENTER_RECEIVER_MAIL') . '<br />';
    }
    if ($mail_receiver && !ValidateEmail($mail_receiver)) {
        $message['message'] .= _t('CONTACT_RECEIVER_MAIL_INVALID') . '<br />';
    }
    // Check message (length)
    if ($type == 'contact' && (!$messagebody || strlen($messagebody) < 10)) {
        $message['message'] .= _t('CONTACT_ENTER_MESSAGE') . '<br />';
    }
    // If no errors, we inform of success!
    if ($message['message'] == '') {
        $message['class'] = 'success';
    }
    return $message;
}
Exemple #3
0
 function ValidateDnsEmail($Value, $Field = '')
 {
     if ($Value === NULL) {
         return True;
     }
     // + required
     $Result = ValidateEmail($Value, $Field);
     if ($Result !== True) {
         return 'ValidateEmail';
     }
     list($User, $Host) = explode('@', $Value);
     $MxHosts = array();
     $Result = getmxrr($Host, $MxHosts);
     return $Result;
 }
Exemple #4
0
 /**
  * Send welcome email to user.
  *
  * @param int $UserID
  * @param string $Password
  * @param string $RegisterType
  * @param array|null $AdditionalData
  * @throws Exception
  */
 public function sendWelcomeEmail($UserID, $Password, $RegisterType = 'Add', $AdditionalData = null)
 {
     $Session = Gdn::session();
     $Sender = $this->getID($Session->UserID);
     $User = $this->getID($UserID);
     if (!ValidateEmail($User->Email)) {
         return;
     }
     $AppTitle = Gdn::config('Garden.Title');
     $Email = new Gdn_Email();
     $Email->subject(sprintf(t('[%s] Welcome Aboard!'), $AppTitle));
     $Email->to($User->Email);
     $emailTemplate = $Email->getEmailTemplate();
     $Data = [];
     $Data['User'] = arrayTranslate((array) $User, ['UserID', 'Name', 'Email']);
     $Data['Sender'] = arrayTranslate((array) $Sender, ['Name', 'Email']);
     $Data['Title'] = $AppTitle;
     if (is_array($AdditionalData)) {
         $Data = array_merge($Data, $AdditionalData);
     }
     $Data['EmailKey'] = valr('Attributes.EmailKey', $User);
     $message = '<p>' . formatString(t('Hello {User.Name}!'), $Data) . ' ';
     $message .= $this->getEmailWelcome($RegisterType, $User, $Data, $Password);
     // Add the email confirmation key.
     if ($Data['EmailKey']) {
         $emailUrlFormat = '{/entry/emailconfirm,exurl,domain}/{User.UserID,rawurlencode}/{EmailKey,rawurlencode}';
         $url = formatString($emailUrlFormat, $Data);
         $message .= '<p>' . t('You need to confirm your email address before you can continue.') . '</p>';
         $emailTemplate->setButton($url, t('Confirm My Email Address'));
     } else {
         $emailTemplate->setButton(externalUrl('/'), t('Access the Site'));
     }
     $emailTemplate->setMessage($message);
     $emailTemplate->setTitle(t('Welcome Aboard!'));
     $Email->setEmailTemplate($emailTemplate);
     try {
         $Email->send();
     } catch (Exception $e) {
         if (debug()) {
             throw $e;
         }
     }
 }
Exemple #5
0
 /**
  * Send welcome email to user.
  *
  * @param $UserID
  * @param $Password
  * @param string $RegisterType
  * @param null $AdditionalData
  * @throws Exception
  */
 public function sendWelcomeEmail($UserID, $Password, $RegisterType = 'Add', $AdditionalData = null)
 {
     $Session = Gdn::session();
     $Sender = $this->getID($Session->UserID);
     $User = $this->getID($UserID);
     if (!ValidateEmail($User->Email)) {
         return;
     }
     $AppTitle = Gdn::config('Garden.Title');
     $Email = new Gdn_Email();
     $Email->subject(sprintf(t('[%s] Welcome Aboard!'), $AppTitle));
     $Email->to($User->Email);
     $Data = array();
     $Data['User'] = arrayTranslate((array) $User, array('UserID', 'Name', 'Email'));
     $Data['Sender'] = arrayTranslate((array) $Sender, array('Name', 'Email'));
     $Data['Title'] = $AppTitle;
     if (is_array($AdditionalData)) {
         $Data = array_merge($Data, $AdditionalData);
     }
     $Data['EmailKey'] = valr('Attributes.EmailKey', $User);
     // Check for the new email format.
     if (($EmailFormat = t("EmailWelcome{$RegisterType}", '#')) != '#') {
         $Message = formatString($EmailFormat, $Data);
     } else {
         $Message = sprintf(t('EmailWelcome'), $User->Name, $Sender->Name, $AppTitle, ExternalUrl('/'), $Password, $User->Email);
     }
     // Add the email confirmation key.
     if ($Data['EmailKey']) {
         $Message .= "\n\n" . FormatString(t('EmailConfirmEmail', self::DEFAULT_CONFIRM_EMAIL), $Data);
     }
     $Message = $this->_addEmailHeaderFooter($Message, $Data);
     $Email->message($Message);
     $Email->send();
 }
Exemple #6
0
// Check email
function ValidateEmail($value)
{
$regex = "/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)*\.([a-zA-Z]{2,6})$/";
if($value == "") {
return false;
} else {
$string = preg_replace($regex, "", $value);
}
return empty($string) ? true : false;
}
if(!$text)
{
$error .= "Введите email";
}
if($text && !ValidateEmail($text))
{
$error .= "Введите корректный email";
}
//

if(!$error)
{
$subject ="Новая подписка!";
$message ="На сайте vitastretta.ru оформлена новая подписка!\n\nE-mail: ".$text."";
$mail = mail("*****@*****.**", $subject, $message,

"From: ".$name." <".$text."> "."Reply-To: ".$text." "." X-Mailer: PHP/" . phpversion());
if($mail)
{
echo 'OK';
Exemple #7
0
 }
 $error = '';
 foreach ($_POST as $key => $value) {
     $_POST[$key] = stripslashes(trim($value));
     if ($formFields[$key]['mandatory'] == 1) {
         // Mandatory?
         $value = stripslashes(trim($_POST[$key]));
         if ($formFields[$key]['validation']['basic'] == 1) {
             // Basic Validation
             if (!$value) {
                 $error .= $formFields[$key]['errors']['none'] . '<br />';
             }
         }
         if ($formFields[$key]['validation']['email'] == 1) {
             // E-Mail Validation
             if (!ValidateEmail($value)) {
                 $error .= $formFields[$key]['errors']['invalid'] . '<br />';
             }
         }
         if ($formFields[$key]['validation']['min_chars'] > 0) {
             // Minimum Chars
             if (strlen($value) < $formFields[$key]['validation']['min_chars']) {
                 $error .= str_replace('[min_chars]', $formFields[$key]['validation']['min_chars'], $formFields[$key]['errors']['min_chars']) . '<br />';
             }
         }
     }
 }
 if (USE_CAPTCHA == 1) {
     $security_code = trim(strtolower($_POST['security_code']));
     if ($security_code == '') {
         $error .= $form_notifications['security_code_e'];
                continue;
            } elseif ($key === 'firm') {
                $first_title = 'Производитель: ';
            } elseif ($key === 'count') {
                $first_title = 'Количество: ';
            } elseif ($key === 'price') {
                $first_title = 'Цена: ';
            } elseif ($key === 'totalPrice') {
                continue;
            }
            $message2 .= '<div style="clear: both; float: left; width: 45%; margin-right: 5%;">' . $first_title . '</div><div style="float: left; width: 50%;">' . $value . '</div>';
            $message2 .= '</div>';
        }
        $message2 .= '</div>';
    }
    $message2 .= '<div style="text-align: center;">Итоговая цена: <span style="color: #22aba6; margin-bottom: 20px;">' . $total_price . '</span> рублей</div>';
    $message2 .= "</div></body></html>";
    if (!ValidateEmail($email)) {
        $error = 'Your email is wrong!';
    }
    $message = wordwrap($message, 70);
    if (!$error) {
        $mail = mail($email, $subject, $message, "From: " . $name . " <" . $email . ">\r\n" . "Reply-To: " . $email . "\r\n" . "Content-type: text/html; charset=utf-8 \r\n" . "X-Mailer: PHP/" . phpversion());
        $mail2 = mail($siteEmail, $subject, $message2, "From: " . $name . " <" . $email . ">\r\n" . "Reply-To: " . $email . "\r\n" . "Content-type: text/html; charset=utf-8 \r\n" . "X-Mailer: PHP/" . phpversion());
        if ($mail && $mail2) {
            echo 'ok';
        }
    } else {
        echo '<div class="bg-error">' . $error . '</div>';
    }
}
Exemple #9
0
    if (!$mail->ValidateAddress($email)) {
        $msg = 'You must specify a valid email address.';
        return false;
    }
    return true;
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $name = trim($_POST['name']);
    $phone = trim($_POST['phone']);
    $email = trim($_POST['email']);
    $message = trim($_POST['message']);
    $data = array();
    if (Validate($name, $phone, $email, $message)) {
        require_once 'inc/phpmailer.php';
        $mail = new PHPMailer();
        if (ValidateEmail($mail, $email)) {
            $email_body = '';
            $email_body = $email_body . 'Name: ' . $name . '<br>';
            $email_body = $email_body . 'Phone: ' . $phone . '<br>';
            $email_body = $email_body . 'Email: ' . $email . '<br>';
            $email_body = $email_body . 'Message: ' . $message . '<br>';
            $mail->isSMTP();
            $mail->Host = 'smtp.sendgrid.net';
            $mail->SMTPAuth = true;
            $mail->Username = SD_USERNAME;
            $mail->Password = SD_PASSWORD;
            $mail->SMTPSecure = 'tls';
            $mail->Port = 587;
            $mail->SetFrom($email, $name);
            $address = '*****@*****.**';
            $mail->AddAddress($address, 'Renaissance');
Exemple #10
0
// Check all fields are populated
foreach ($params as $param) {
    if (isset($_POST[$param]) && $_POST[$param] != "") {
        $details[$param] = $_POST[$param];
        setcookie($param, $_POST[$param], time() + 60 * 60 * 24 * 30);
    } else {
        if ($param != "giftWrapped") {
            $detailsChecked = false;
            $error[$param] = "Required field";
        }
    }
}
// Validate email
if (isset($details["email"])) {
    $details["email"] = RemoveExtraChars($details["email"]);
    if (!ValidateEmail($details["email"])) {
        $error["email"] = "Email is not valid, please enter a valid email.";
        $detailsChecked = false;
    }
}
// Validate phone number
if (isset($details["contactNumber"])) {
    $details["contactNumber"] = RemoveExtraChars($details["contactNumber"]);
}
// Validate credit card number
if (isset($details["cardNumber"]) && $details["cardNumber"] != "") {
    $details["cardNumber"] = RemoveExtraChars($details["cardNumber"]);
    $check = ValidateCard($details["cardNumber"]);
    if ($check !== false) {
        $details["cardType"] = $check;
    } else {
Exemple #11
0
     if (GetValue($Param, $this->Data['MyMeta'])) {
         $Params[] = $this->Data['MyMeta'][$Param];
     }
 }
 switch ($this->Data['MetaSpec'][$MetaI]['type']) {
     case 'text':
         $MetaV = Gdn_Format::Text($MetaV);
         $Picasa = '';
         $Flickr = '';
         if ($this->Data['MetaSpec'][$MetaI]['social'] == 'picasa') {
             $Picasa = '<input type="hidden" class="picsa" value="' . $MetaV . '" />';
         }
         if ($this->Data['MetaSpec'][$MetaI]['social'] == 'flickr') {
             $Flickr = '<input type="hidden" class="flickr" value="' . $MetaV . '" />';
         }
         if (ValidateEmail($MetaV)) {
             $MetaV = Email($MetaV);
         } else {
             if (ValidateWebAddress($MetaV) && preg_match('`\\.(jpg|jpeg|gif|png)$`i', $MetaV)) {
                 $MetaV = Anchor(Img($MetaV, $MetaV), $MetaV);
             } else {
                 if (ValidateWebAddress($MetaV)) {
                     $LabelDefault = Gdn_Format::Text(GetValue('labeldefault', $this->Data['MetaSpec'][$MetaI]));
                     $Params = array_merge(array($this->User->Name, $this->Data['MetaSpec'][$MetaI]['name']), $Params);
                     $MetaV = '<a href="' . $MetaV . '">' . vsprintf(T('MyMeta.' . $MetaI . '.Label', $LabelDefault ? $LabelDefault : '%2$s'), $Params) . '</a>';
                 } else {
                     if ($this->Data['MetaSpec'][$MetaI]['urlformat'] && ValidateWebAddress($this->Data['MetaSpec'][$MetaI]['urlformat'])) {
                         $LabelDefault = Gdn_Format::Text(GetValue('labeldefault', $this->Data['MetaSpec'][$MetaI]));
                         $Params = array_merge(array($this->User->Name, $this->Data['MetaSpec'][$MetaI]['name']), $Params);
                         $MetaV = '<a href="' . str_replace('[id]', $MetaV, $this->Data['MetaSpec'][$MetaI]['urlformat']) . '">' . vsprintf(T('MyMeta.' . $MetaI . '.Label', $LabelDefault ? $LabelDefault : '%2$s'), $Params) . '</a>';
                     }
Exemple #12
0
include_once '/objects/objects.php';
if (!isset($_SESSION)) {
    session_start();
}
$err = "";
$hienthi = "dangky";
if (isset($_GET['do']) && $_GET['do'] == 'reg') {
    if ($_POST['displayname'] != "") {
        if ($_POST['username'] != "") {
            if (strlen(trim($_POST['username'])) > 5) {
                if ($_POST['email'] != "") {
                    if ($_POST['pass'] != "") {
                        if (strlen(trim($_POST['pass'])) > 5) {
                            if ($_POST['pass'] == $_POST['repass']) {
                                if (ValidateEmail($_POST['email'])) {
                                    $taikhoan = new TaiKhoan();
                                    $taikhoan->Email = $_POST['email'];
                                    $taikhoan->TenDangNhap = $_POST['username'];
                                    $taikhoan->MatKhau = $_POST['pass'];
                                    $taikhoan->TenHienThi = $_POST['displayname'];
                                    $taikhoan->IP = $_SERVER['REMOTE_ADDR'];
                                    $taikhoan->NgayDangKy = time();
                                    $r = $taikhoan->DangKy();
                                    if ($r > 0) {
                                        $hienthi = "thanhcong";
                                        $_SESSION['taikhoan'] = serialize(TaiKhoan::LayTaiKhoan($taikhoan->TenDangNhap));
                                    }
                                    if ($r == -1) {
                                        $err = "Tên đăng nhập đã có người sử dụng!";
                                    } else {
 $error_url = '';
 $error = '';
 $mysql_server = 'localhost';
 $mysql_database = 'oos1';
 $mysql_table = 'asc_admin';
 $mysql_username = '******';
 $mysql_password = '';
 $eol = "\n";
 $max_filesize = isset($_POST['filesize']) ? $_POST['filesize'] * 1024 : 1024000;
 $boundary = md5(uniqid(time()));
 $header = 'From: ' . $mailfrom . $eol;
 $header .= 'Reply-To: ' . $mailfrom . $eol;
 $header .= 'MIME-Version: 1.0' . $eol;
 $header .= 'Content-Type: multipart/mixed; boundary="' . $boundary . '"' . $eol;
 $header .= 'X-Mailer: PHP v' . phpversion() . $eol;
 if (!ValidateEmail($mailfrom)) {
     $error .= "The specified email address is invalid!\n<br>";
 }
 if (!empty($error)) {
     $errorcode = file_get_contents($error_url);
     $replace = "##error##";
     $errorcode = str_replace($replace, $error, $errorcode);
     echo $errorcode;
     exit;
 }
 $internalfields = array("submit", "reset", "send", "filesize", "formid", "captcha_code", "recaptcha_challenge_field", "recaptcha_response_field", "g-recaptcha-response");
 $message .= $eol;
 $message .= "IP Address : ";
 $message .= $_SERVER['REMOTE_ADDR'];
 $message .= $eol;
 foreach ($_POST as $key => $value) {
 $name = stripslashes($_POST['name']);
 $email = trim($_POST['email']);
 $message = stripslashes($_POST['message']);
 $phone = stripslashes($_POST['phone']);
 $answer = trim($_POST['answer']);
 $verificationanswer = "6";
 // plz change edit your human answer
 $from = $email;
 $to = $replyto;
 $error = '';
 $headers = "From: {$name} <" . $email . "> \n";
 $headers .= "Reply-to:" . $email . "\n";
 $headers .= 'MIME-Version: 1.0' . "\r\n";
 $headers = "Content-Type: text/html; charset=utf-8\n" . $headers;
 // Checks Name Field
 if (!$name || !$email || $email && !ValidateEmail($email) || $answer != $verificationanswer || !$message || strlen($message) < 1) {
     $error .= 'Please fill the required fields correctly.<br />';
 }
 if (!$error) {
     $messages .= "Name: {$name} <br>";
     $messages .= "Email: {$email} <br>";
     $messages .= "Message: {$message} <br>";
     $mail = mail($to, $subject, $messages, $headers);
     if ($mail) {
         echo 'OK';
         if ($autorespond == "yes") {
             include "autoresponde.php";
         }
     }
 } else {
     echo '<div class="error">' . $error . '</div>';
Exemple #15
0
 /**
  * Send welcome email to user.
  *
  * @param $UserID
  * @param $Password
  * @param string $RegisterType
  * @param null $AdditionalData
  * @throws Exception
  */
 public function sendWelcomeEmail($UserID, $Password, $RegisterType = 'Add', $AdditionalData = null)
 {
     $Session = Gdn::session();
     $Sender = $this->getID($Session->UserID);
     $User = $this->getID($UserID);
     if (!ValidateEmail($User->Email)) {
         return;
     }
     $AppTitle = Gdn::config('Garden.Title');
     $Email = new Gdn_Email();
     $Email->subject(sprintf(t('[%s] Welcome Aboard!'), $AppTitle));
     $Email->to($User->Email);
     $emailTemplate = $Email->getEmailTemplate();
     $Data = array();
     $Data['User'] = arrayTranslate((array) $User, array('UserID', 'Name', 'Email'));
     $Data['Sender'] = arrayTranslate((array) $Sender, array('Name', 'Email'));
     $Data['Title'] = $AppTitle;
     if (is_array($AdditionalData)) {
         $Data = array_merge($Data, $AdditionalData);
     }
     $Data['EmailKey'] = valr('Attributes.EmailKey', $User);
     $message = '<p>' . formatString(t('Hello {User.Name}!'), $Data) . ' ';
     switch ($RegisterType) {
         case 'Connect':
             $message .= formatString(t('You have successfully connected to {Title}.'), $Data) . ' ' . t('Find your account information below.') . '<br></p>' . '<p>' . sprintf(t('%s: %s'), t('Username'), val('Name', $User)) . '<br>' . formatString(t('Connected With: {ProviderName}'), $Data) . '</p>';
             break;
         case 'Register':
             $message .= formatString(t('You have successfully registered for an account at {Title}.'), $Data) . ' ' . t('Find your account information below.') . '<br></p>' . '<p>' . sprintf(t('%s: %s'), t('Username'), val('Name', $User)) . '<br>' . sprintf(t('%s: %s'), t('Email'), val('Email', $User)) . '</p>';
             break;
         default:
             $message .= sprintf(t('%s has created an account for you at %s.'), val('Name', $Sender), $AppTitle) . ' ' . t('Find your account information below.') . '<br></p>' . '<p>' . sprintf(t('%s: %s'), t('Email'), val('Email', $User)) . '<br>' . sprintf(t('%s: %s'), t('Password'), $Password) . '</p>';
     }
     // Add the email confirmation key.
     if ($Data['EmailKey']) {
         $emailUrlFormat = '{/entry/emailconfirm,exurl,domain}/{User.UserID,rawurlencode}/{EmailKey,rawurlencode}';
         $url = formatString($emailUrlFormat, $Data);
         $message .= '<p>' . t('You need to confirm your email address before you can continue.') . '</p>';
         $emailTemplate->setButton($url, t('Confirm My Email Address'));
     } else {
         $emailTemplate->setButton(externalUrl('/'), t('Access the Site'));
     }
     $emailTemplate->setMessage($message);
     $emailTemplate->setTitle(t('Welcome Aboard!'));
     $Email->setEmailTemplate($emailTemplate);
     $Email->send();
 }
Exemple #16
0
$post = !empty($_POST) ? true : false;
if ($post) {
    $name = stripslashes($_POST['name']);
    $email = trim($_POST['email']);
    $subject = stripslashes($_POST['subject']);
    $message = stripslashes($_POST['message']);
    $error = '';
    // Check name
    if (!$name || $name == "Name*") {
        $error .= ' name,';
    }
    // Check email
    if (!$email || $email == "Email*") {
        $error .= ' e-mail address,';
    }
    if ($email && !ValidateEmail($email)) {
        $error .= ' valid e-mail address,';
    }
    // Check message
    if (!$message) {
        $error .= " message,";
    }
    if (!$error) {
        $mail = mail(WEBMASTER_EMAIL, $subject, $message, "From: " . $name . " <" . $email . ">\r\n" . "Reply-To: " . $email . "\r\n" . "X-Mailer: PHP/" . phpversion());
        if ($mail) {
            echo 'OK';
        }
    } else {
        echo '<div class="formstatuserror">Enter your' . $error . ' please!</div>';
    }
}
 /**
  * Prompts new admins how to get started using new install.
  *
  * @since 2.0.0
  * @access public
  */
 public function GettingStarted()
 {
     $this->Permission('Garden.Settings.Manage');
     $this->SetData('Title', T('Getting Started'));
     $this->AddSideMenu('dashboard/settings/gettingstarted');
     $this->TextEnterEmails = T('TextEnterEmails', 'Type email addresses separated by commas here');
     if ($this->Form->AuthenticatedPostBack()) {
         // Do invitations to new members.
         $Message = $this->Form->GetFormValue('InvitationMessage');
         $Message .= "\n\n" . Gdn::Request()->Url('/', TRUE);
         $Message = trim($Message);
         $Recipients = $this->Form->GetFormValue('Recipients');
         if ($Recipients == $this->TextEnterEmails) {
             $Recipients = '';
         }
         $Recipients = explode(',', $Recipients);
         $CountRecipients = 0;
         foreach ($Recipients as $Recipient) {
             if (trim($Recipient) != '') {
                 $CountRecipients++;
                 if (!ValidateEmail($Recipient)) {
                     $this->Form->AddError(sprintf(T('%s is not a valid email address'), $Recipient));
                 }
             }
         }
         if ($CountRecipients == 0) {
             $this->Form->AddError(T('You must provide at least one recipient'));
         }
         if ($this->Form->ErrorCount() == 0) {
             $Email = new Gdn_Email();
             $Email->Subject(T('Check out my new community!'));
             $Email->Message($Message);
             foreach ($Recipients as $Recipient) {
                 if (trim($Recipient) != '') {
                     $Email->To($Recipient);
                     try {
                         $Email->Send();
                     } catch (Exception $ex) {
                         $this->Form->AddError($ex);
                     }
                 }
             }
         }
         if ($this->Form->ErrorCount() == 0) {
             $this->InformMessage(T('Your invitations were sent successfully.'));
         }
     }
     $this->Render();
 }
Exemple #18
0
    include_once 'objects/taikhoan.php';
    include_once 'include/functions.php';
    $taikhoan = TaiKhoan::LayTheoID($id);
    $hashmatkhau = md5($taikhoan->ID . $taikhoan->TenDangNhap . $taikhoan->MatKhau . $taikhoan->NgayDangKy . $taikhoan->DangNhapCuoi);
    $hash = $_GET['pw'];
    if ($hash == $hashmatkhau) {
        $_SESSION['taikhoan'] = serialize($taikhoan);
        include_once './include/doimatkhauquen.php';
        return;
    } else {
        header("location:index.php");
        return;
    }
}
if (isset($_POST['submit'])) {
    if ($_POST['email'] != "" && ValidateEmail($_POST['email'])) {
        include_once 'include/functions.php';
        include_once './objects/taikhoan.php';
        include_once './include/mail.php';
        $taikhoan = TaiKhoan::LayTaiKhoanTheoEmail($_POST['email']);
        if ($taikhoan != NULL) {
            $hashmatkhau = md5($taikhoan->ID . $taikhoan->TenDangNhap . $taikhoan->MatKhau . $taikhoan->NgayDangKy . $taikhoan->DangNhapCuoi);
            $duongdan = WEBPATH . "/quenmatkhau.php?u=" . $taikhoan->ID . "&pw=" . $hashmatkhau;
            //doi doan ma hash ve u=1&pw=
            if (SendForgotEmail($taikhoan->TenHienThi, $taikhoan->Email, $duongdan)) {
                echo '<div class="content-thongbao">Đã gởi 1 email về mail của bạn</div>';
                return;
            } else {
                echo 'Đường truyền thất bại !';
            }
        } else {