Beispiel #1
0
function saveFeedback()
{
    $feedback = array('name' => '', 'email' => '', 'subject' => '', 'message' => '', 'userid' => $_SESSION['SESS_USER_ID'], 'blocked' => 'false', 'dtoc' => date('Y-m-d H:i:s'), 'dtoe' => date('Y-m-d H:i:s'));
    foreach ($feedback as $k => $v) {
        if (isset($_POST[$k])) {
            $feedback[$k] = trim($_POST[$k]);
        }
    }
    $sql = _db()->_insertQ1('feedbacks', $feedback);
    $res = _dbQuery($sql);
    $id = _db()->insert_id();
    if ($res) {
        _dbFree($res);
        //send email to admin
        $mailto = "*****@*****.**";
        $mailfrom = "*****@*****.**";
        $feedback_content = array("name" => $_REQUEST['name'], "email" => $_REQUEST['email'], "subject" => $_REQUEST['subject'], "message" => $_REQUEST['message']);
        $template = _template("feedback_admin", $profile);
        loadHelpers('email');
        sendMail($mailto, " Feedback", $template, $mailfrom);
        return "success";
    } else {
        return "error";
    }
}
 function processing()
 {
     global $site;
     set_time_limit(36000);
     ignore_user_abort();
     $sResult = "";
     $iPerStart = (int) trim(getParam('msgs_per_start'));
     $iFullCount = (int) $GLOBALS['MySQL']->getOne('SELECT COUNT(*) FROM `sys_sbs_queue`');
     if ($iFullCount) {
         $iProcess = $iFullCount < $iPerStart ? $iFullCount : $iPerStart;
         $sResult .= "\n- Start email send -\n";
         $sResult .= "Total queued emails: " . $iFullCount . "\n";
         $sResult .= "Ready for send: " . $iProcess . "\n";
         $aMails = $GLOBALS['MySQL']->getAll("SELECT `id`, `email`, `subject`, `body` FROM `sys_sbs_queue` ORDER BY `id` LIMIT 0, " . $iProcess);
         $iSent = 0;
         $aIds = array();
         foreach ($aMails as $aMail) {
             $aIds[] = $aMail['id'];
             if (sendMail($aMail['email'], $aMail['subject'], $aMail['body'])) {
                 $iSent++;
             } else {
                 $sResult .= "Cannot send message to " . $aMail['email'] . "\n";
             }
         }
         $GLOBALS['MySQL']->query("DELETE FROM `sys_sbs_queue` WHERE `id` IN ('" . implode("','", $aIds) . "')");
         $sResult .= "Processed emails: " . $iSent . "\n";
         sendMail($site['email'], $site['title'] . ": Periodic Report", $sResult, 0, array(), 'text');
     }
 }
Beispiel #3
0
function addUser($user, $email, $pass, $hashed = false)
{
    //Hash the password if not hashed.
    if (!$hashed) {
        $hashedPass = hashPass($user, $pass);
    } else {
        $hashedPass = $pass;
    }
    // Default database connect //
    $msconf = getDatabaseCredentials();
    $dbcon = mysqli_connect($msconf['host'], $msconf['user'], $msconf['pass'], $msconf['db']);
    if (mysqli_connect_errno($dbcon)) {
        echo "Failed to connect to MySQL: " . mysqli_connect_errno($dbcon) . " : " . mysqli_connect_error();
        die;
    }
    $dbcon->query('CREATE TABLE IF NOT EXISTS `Users` (`Username` varchar(16) NOT NULL, `Name` varchar(60) NOT NULL, `PassHash` varchar(256) NOT NULL, `APIKey` varchar(256) NULL, `Permission` varchar(2) NOT NULL DEFAULT \'NN\', UNIQUE KEY `Username` (`Username`)) ENGINE=InnoDB DEFAULT CHARSET=latin1;');
    $dbcon->query('CREATE TABLE IF NOT EXISTS `Blog` (`PUID` varchar(200) NOT NULL,`Post` varchar(10000) NOT NULL,`Date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `Author` varchar(16) NOT NULL, `Title` varchar(60) NOT NULL, UNIQUE KEY `PUID` (`PUID`)) ENGINE=InnoDB DEFAULT CHARSET=latin1;');
    $dbcon->query('INSERT INTO `Users` (`Username`, `Name`, `PassHash`, `Permission`) VALUES (\'ace\', \'Cory Redmond\', \'2y11$WULjGCfjZEvtGEXfZkL3G.uzF3fRlJPGVsR.jCGguRhKIuph28572\', \'YY\');');
    // Default database connect //
    $ver = substr(preg_replace("/[^a-zA-Z0-9]+/", "", hashPass($user, @date('d/m/Y H:i') . $user . microtime() . time())), -10);
    $preparedStm = $dbcon->prepare("INSERT INTO `ace`.`Users` (`Username`, `Email`, `PassHash`, `Verified`, `UUID`) VALUES (?, ?, ?, ?, ?);");
    $preparedStm->bind_param("sssss", $user, $email, $hashedPass, $ver, $ver);
    if (!$preparedStm->execute()) {
        $errNo = $preparedStm->errno;
        if ($errNo == 1062) {
            return "DUPE";
        }
    } else {
        @(include_once "../includes/util.php");
        @(include_once "util.php");
        @(include_once "includes/util.php");
        return sendMail($user, $email, "https://profiles.ac3-servers.eu/verify/?c={$ver}");
    }
    return true;
}
Beispiel #4
0
function sendNotify($userid, $msg, $link, $subject = null)
{
    $umail = "*****@*****.**";
    $ufname = "eDart";
    $ulname = "User";
    $domail = 1;
    //PART I: Write to the database
    $con = mysqli_connect(host(), username(), password(), mainDb());
    $q = "INSERT INTO notify(`usr`,`date`,`message`,`link`) VALUES('" . mysqli_real_escape_string($con, $userid) . "','" . mysqli_real_escape_string($con, time()) . "','" . mysqli_real_escape_string($con, $msg) . "','" . mysqli_real_escape_string($con, $link) . "')";
    //Insert a new row into the author's notifications
    mysqli_query($con, $q);
    //Execute
    $user_call = new User(array("action" => "get", "id" => $userid));
    $user_info = $user_call->run(true);
    if (count($user_info) != 0) {
        $user_info = $user_info[0];
        $umail = $user_info["email"];
        $ufname = ucwords($user_info["fname"]);
        $ulname = ucwords($user_info["lname"]);
        $domail = $user_info["do_mail"];
    }
    $greetings = array("Just wanted to let you know that:<br><br> %s. <br><br>That is all. Have a good rest of your day!", "In case you didn't know: <br><br>%s<br><br> Better go check it out.", "We hope you're having a good day! Just thought you might you want to know:<br><br> %s. <br><br>That is all. Carry on!", "Don't mean to break your flow, but we just thought you might want to know that<br><br> %s. <br><br>If you get the chance, you can check it out back at eDart. For now, live long and prosper!", "Hope your day is going splendidly! Just thought we'd let you know that:<br><br> %s. <br><br>When you have the time, check it out on eDart. Cool. For now, bye.");
    $fullmsg = sprintf($greetings[rand(0, count($greetings) - 1)], $msg);
    if ($subject == null) {
        $subject = $msg;
    }
    //PART II: Send them an email
    if ($domail == 1) {
        sendMail($umail, $ufname, $ulname, $subject, $fullmsg, $link, "View on eDart");
    }
}
Beispiel #5
0
/**
 * send "tell a friend" email
 */
function SendTellFriend($iSenderID = 0)
{
    global $profileID;
    $sSenderName = clear_xss(bx_get('sender_name'));
    $sSenderEmail = clear_xss(bx_get('sender_email'));
    if (strlen(trim($sSenderEmail)) <= 0) {
        return 0;
    }
    $sRecipientEmail = clear_xss(bx_get('recipient_email'));
    if (strlen(trim($sRecipientEmail)) <= 0) {
        return 0;
    }
    $sLinkAdd = $iSenderID > 0 ? 'idFriend=' . $iSenderID : '';
    $rEmailTemplate = new BxDolEmailTemplates();
    if ($profileID) {
        $aTemplate = $rEmailTemplate->getTemplate('t_TellFriendProfile', getLoggedId());
        $Link = getProfileLink($profileID, $sLinkAdd);
    } else {
        $aTemplate = $rEmailTemplate->getTemplate('t_TellFriend', getLoggedId());
        $Link = BX_DOL_URL_ROOT;
        if (strlen($sLinkAdd) > 0) {
            $Link .= '?' . $sLinkAdd;
        }
    }
    return sendMail($sRecipientEmail, $aTemplate['Subject'], $aTemplate['Body'], '', array('Link' => $Link, 'FromName' => $sSenderName));
}
function makeTrade($tradeAmt, $pair, $action, $latestPrice)
{
    global $api, $totalBalance;
    if ($action == 'buy') {
        try {
            $tradeResult = $api->makeOrder($tradeAmt, $pair, BTCeAPI::DIRECTION_BUY, $latestPrice);
        } catch (BTCeAPIInvalidParameterException $e) {
            echo $e->getMessage();
        } catch (BTCeAPIException $e) {
            echo $e->getMessage();
        }
    } else {
        //sell
        try {
            $tradeResult = $api->makeOrder($tradeAmt, $pair, BTCeAPI::DIRECTION_SELL, $latestPrice);
        } catch (BTCeAPIInvalidParameterException $e) {
            echo $e->getMessage();
        } catch (BTCeAPIException $e) {
            echo $e->getMessage();
        }
    }
    if ($tradeResult['success'] == 1) {
        echo $msg = $action . ' ' . $tradeAmt . ' of ' . $pair . ' at price ' . $latestPrice . "\n" . 'balance: ' . $totalBalance . "\n" . 'time: ' . date('Y-m-d H:i:s', time());
        sendMail($msg);
    }
}
Beispiel #7
0
function notify(&$evt, $date, $daysDue)
{
    global $emlStyle, $set, $xx, $ax;
    $todayD = date("Y-m-d", time() + 43200);
    //today 12:00
    //compose email message
    $dateTime = IDtoDD($date) . ' ' . $xx['at_time'] . ' ' . (($evt['sti'] or $evt['eti']) ? ITtoDT($evt['sti']) : $ax['cro_all_day']);
    if ($evt['eti']) {
        $dateTime .= " - " . ITtoDT($evt['eti']);
    }
    $status = '';
    if ($evt['cbx']) {
        $status .= $evt['clb'] . ': ' . (strpos($evt['chd'], $date) ? $evt['cmk'] : '- -');
    }
    $subject = "{$set['calendarTitle']} - " . ($daysDue ? "{$ax['cro_due_in']} {$daysDue} {$ax['cro_days']}" : $ax['cro_due_today']) . ": " . $evt['tit'];
    if ($set['eventColor']) {
        $eStyle = ($evt['cco'] ? "color:{$evt['cco']};" : '') . ($evt['cbg'] ? "background-color:{$evt['cbg']};" : '');
    } else {
        $eStyle = $evt['uco'] ? "background-color:{$evt['uco']};" : '';
    }
    $eStyle = $eStyle ? " style=\"{$eStyle}\"" : '';
    $calUrl = $set['calendarUrl'] . (strpos($set['calendarUrl'], '?', 6) ? '&amp;' : '?') . 'cD=' . $date;
    $evtText = makeE($evt, $set['evtTemplGen'], 'td', '', '12345');
    $msgText = "\n<html>\n<head>\n<title>{$set['calendarTitle']} {$ax['cro_mailer']}</title>\n<style type='text/css'>\nbody, p, table {{$emlStyle}}\ntd {vertical-align:top;}\n</style>\n</head>\n<body>\n<p>{$set['calendarTitle']} {$ax['cro_mailer']} " . IDtoDD($todayD) . "</p>\n<p>" . ($daysDue ? "{$ax['cro_event_due_in']} {$daysDue} {$ax['cro_days']}" : $ax['cro_event_due_today']) . ":</p>\n<table>\n\t<tr><td>{$ax['cro_title']}:</td><td><b><span{$eStyle}>{$evt['tit']}</span></b></td></tr>\n\t" . ($evt['cbx'] ? "<tr><td>{$ax['cro_status']}:</td><td>{$status}</td></tr>" : '') . "\n\t<tr><td>{$ax['cro_date_time']}:</td><td>{$dateTime}</td></tr>\n\t{$evtText}\n</table>\n<p><a href='{$calUrl}'>{$ax['cro_open_calendar']}</a></p>\n</body>\n</html>\n";
    //send notification
    $sender = $set['notifSender'] ? $evt['uid'] : 0;
    $sent = sendMail($subject, $msgText, $evt['rml'], $sender);
    $sentTo = $sent ? "{$sent} - {$ax['cro_subject']}: {$subject}" : "Sending mail failed. See logs/luxcal.log for details";
    return $sentTo;
}
Beispiel #8
0
function UserMailInfo($userid)
{
    if (create_connection($connection)) {
        $userInfo = getUserInfo($connection, $userid);
        //0: id 1: username 2: mail 3: password 4: salt 5: apikey_write 6: apikey_read 7: lastlogin 8: admin 9: gravatar 10: name 11: location 12: timezone 13: language 14: bio
        if ($userInfo != null) {
            echo "Buscando alarmas para usuario: [" . $userInfo[0] . "] " . $userInfo[1] . " - " . $userInfo[10] . "<br>";
            $userActiveAlarms = getUserActiveAlarms($connection, $userid);
            $userRadPowerAlarms = getUserRadPowerAlarms($connection, $userid);
            $userAlarms = array_merge($userActiveAlarms, $userRadPowerAlarms);
            if (count($userAlarms) > 0) {
                echo "Alarmas encontradas, enviando mensaje...<br>";
                $bodyText = formatMailBody($userAlarms);
                $subject = "Alarmas detectadas - ISMSOLAR";
                $mailbody = file_get_contents("/var/www/html/ewatcher-users/MailBody.html");
                $mailbody = str_replace("[BODY]", $bodyText, $mailbody);
                $MailSentOk = sendMail($mailbody, $subject, $userInfo[2], $userInfo[10]);
                if ($MailSentOk) {
                    echo "llamando a markAlarmsAsNotified<br>";
                    markAlarmsAsNotified($connection, $userAlarms);
                }
            } else {
                echo "No se encontraron alarmas activas para notificar.<br>";
            }
        }
    } else {
        echo "Error de conexión a la base de datos...<br>";
    }
}
function sendMessage($gast_id, $art)
{
    global $link;
    global $unterkunft_id;
    global $root;
    global $sprache;
    include_once $root . "/include/gastFunctions.php";
    include_once $root . "/include/propertiesFunctions.php";
    include_once $root . "/include/mail.inc.php";
    include_once $root . "/include/uebersetzer.php";
    include_once $root . "/include/unterkunftFunctions.php";
    $speech = getGuestSprache($gast_id, $link);
    $gastName = getGuestNachname($gast_id, $link);
    $an = getGuestEmail($gast_id, $link);
    $von = getUnterkunftEmail($unterkunft_id, $link);
    $subject = getUebersetzungUnterkunft(getMessageSubject($unterkunft_id, $art, $link), $speech, $unterkunft_id, $link);
    $anr = getUebersetzungUnterkunft(getMessageAnrede($unterkunft_id, $art, $link), $speech, $unterkunft_id, $link);
    $message = $anr . " " . $gastName . "!\n\n";
    $bod = getUebersetzungUnterkunft(getMessageBody($unterkunft_id, $art, $link), $speech, $unterkunft_id, $link);
    $message .= $bod . "\n\n";
    $unt = getUebersetzungUnterkunft(getMessageUnterschrift($unterkunft_id, $art, $link), $speech, $unterkunft_id, $link);
    $message .= $unt;
    //mail absenden:
    sendMail($von, $an, $subject, $message);
    if (getPropertyValue(MAIL_KOPIE_AN_VERMIETER_ABLEHNUNG, $unterkunft_id, $link) == "true") {
        $message = getUebersetzung("Folgende Nachricht wurde an ihren Gast versendet", $sprache, $link) . ":\n\n" . $message;
        sendMail($von, $von, $subject, $message);
    }
}
Beispiel #10
0
 function ocd_send()
 {
     $message = $this->GetValidGP("message", "Сообщение", VALIDATE_NOT_EMPTY);
     $name = $this->GetValidGP("name", "Имя", VALIDATE_NOT_EMPTY);
     $email = $this->GetValidGP("email", "Email", VALIDATE_EMAIL);
     if ($this->errors['err_count'] > 0) {
         $this->mainTemplate = "./templates/content.tpl";
         $title = $this->dec($this->db->GetOne("Select title From `main_pages` Where page_id='7'", ""));
         $content = $this->dec($this->db->GetOne("Select content From `main_pages` Where page_id='7'", ""));
         $this->pageTitle = $title;
         $this->pageHeader = $title;
         $message = "<textarea name='message' rows='6' style='width: 350px;'>{$message}</textarea>";
         $email = "<input type='text' name='email' value='{$email}' maxlength='50' style='width: 250px;' />";
         $name = "<input type='text' name='name' value='{$name}' maxlength='50' style='width: 250px;' />";
         $this->data = array("MAIN_HEADER" => $this->pageHeader, "MAIN_CONTENT" => $content, "MAIN_MESSAGE" => $message, "MAIN_MESSAGE_ERROR" => $this->GetError("message"), "MAIN_NAME" => $name, "MAIN_NAME_ERROR" => $this->GetError("name"), "MAIN_EMAIL" => $email, "MAIN_EMAIL_ERROR" => $this->GetError("email"), "MAIN_URL" => $this->siteUrl);
         $this->data['FORM'][] = array("_" => "_");
     } else {
         header('Content-type: text/html; charset=utf-8');
         $full_message = "Запрос с сайта: \r\n";
         $full_message .= "Имя отправителя: " . $name . "\r\n";
         $full_message .= "Email отправителя: " . $email . "\r\n";
         $full_message .= "Сообщение: \r\n";
         $full_message .= $message;
         $a = sendMail($this->adminEmail, "Запрос со страницы контактов сайта", $full_message, $this->emailHeader);
         if ($a) {
             $this->Redirect($this->siteUrl . "ok");
         } else {
             $this->Redirect($this->siteUrl . "2");
         }
     }
 }
Beispiel #11
0
function checkError($count, $to, $name, $surname, $phone, $from, $comments, $phone_error, $email_error, $name_error, $sname_error)
{
    $error_messages = '';
    $loopResult = '';
    if ($name_error) {
        $error_messages = $error_messages . "" . $name . " is not a valid name" . "<br>";
    }
    if ($sname_error) {
        $error_messages = $error_messages . "" . $surname . " is not a valid surname" . "<br>";
    }
    if ($email_error) {
        $error_messages = $error_messages . "" . $from . " is not a valid email address" . "<br>";
    }
    if ($phone_error) {
        $error_messages = $error_messages . "" . $phone . " is not a valid phone number" . "<br>";
    }
    if ($count < "1") {
        sendMail($to, $name, $surname, $phone, $from, $comments);
    } else {
        $loopResult .= ' 
                    <div class="maineventfeed"> 
                          <div class="jumbotron" style="background:red;" > 
            <h1 style="color:white;">Error</h1> 
            <h3 style="color:white;">Your form has some errors Im afraid</h3>
            <h2 style="color:white;">' . $error_messages . '</h2><br>
            <button type="button" onclick="goHome();"  class="btn btn-info btn-circle btn-xl"><i class="glyphicon glyphicon-home"></i></button>
            <h4 style="color:white;">Try Again</h4>
            <br>
                          </div> 
                      </div> 
                    
                  ';
        echo $loopResult;
    }
}
Beispiel #12
0
function onPostReply($aTopic, $sPostText, $sUser)
{
    $oProfile = new BxDolProfile($sUser);
    $iProfileId = $oProfile->getID();
    if (BX_ORCA_INTEGRATION == 'dolphin' && !isAdmin($iProfileId)) {
        defineForumActions();
        $iActionId = BX_FORUM_PUBLIC_POST;
        if (isset($aTopic['forum_type']) && 'private' == $aTopic['forum_type']) {
            $iActionId = BX_FORUM_PRIVATE_POST;
        }
        checkAction($iProfileId, $iActionId, true);
        // perform action
    }
    $aPlusOriginal = array('PosterUrl' => $iProfileId ? getProfileLink($iProfileId) : 'javascript:void(0);', 'PosterNickName' => $iProfileId ? getNickName($iProfileId) : $sUser, 'TopicTitle' => $aTopic['topic_title'], 'ReplyText' => $sPostText);
    $oEmailTemplate = new BxDolEmailTemplates();
    $aTemplate = $oEmailTemplate->getTemplate('bx_forum_notifier');
    $fdb = new DbForum();
    $a = $fdb->getSubscribersToTopic($aTopic['topic_id']);
    foreach ($a as $r) {
        if ($r['user'] == $sUser) {
            continue;
        }
        $oRecipient = new BxDolProfile($r['user']);
        $aRecipient = getProfileInfo($oRecipient->_iProfileID);
        $aPlus = array_merge(array('Recipient' => ' ' . getNickName($aRecipient['ID'])), $aPlusOriginal);
        sendMail(trim($aRecipient['Email']), $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus);
    }
    forumAlert('reply', $aTopic['topic_id'], $iProfileId);
}
Beispiel #13
0
/**
 * page code function
 */
function PageCompMainCode()
{
    ob_start();
    $oAccount = BxDolAccount::getInstance();
    $aAccountInfo = $oAccount ? $oAccount->getInfo() : false;
    if (!$aAccountInfo) {
        return DesignBoxContent("Send Email example", 'Please login first', BX_DB_PADDING_DEF);
    }
    echo "<h2>Account info</h2>";
    echo "Email: " . $aAccountInfo['email'] . '<br />';
    echo "Email Confirmed: " . ($aAccountInfo['email_confirmed'] ? 'yes' : 'no') . '<br />';
    echo "Receive site updates: " . ($aAccountInfo['receive_updates'] ? 'yes' : 'no') . '<br />';
    echo "Receive site newsletters: " . ($aAccountInfo['receive_news'] ? 'yes' : 'no') . '<br />';
    echo "Site emails are sent from: " . getParam('site_email_notify') . '<br />';
    $a = array('sys' => array('title' => "Send me system email", 'type' => BX_EMAIL_SYSTEM, 'subj' => 'System Email', 'body' => 'This is system email <br /> {unsubscribe}'), 'notif' => array('title' => "Send me notification", 'type' => BX_EMAIL_NOTIFY, 'subj' => 'Notification Email', 'body' => 'This is notification email<br /> {unsubscribe}'), 'mass' => array('title' => "Send me bulk email", 'type' => BX_EMAIL_MASS, 'subj' => 'Bulk Email', 'body' => 'This is bulk email<br /> {unsubscribe}'));
    $sSendMail = bx_get('send');
    if ($sSendMail && isset($a[$sSendMail])) {
        echo "<h2>Send Email Result</h2>";
        $r = $a[$sSendMail];
        if (sendMail($aAccountInfo['email'], $r['subj'], $r['body'], 0, array(), $r['type'])) {
            echo MsgBox($r['subj'] . ' - successfully sent');
        } else {
            echo MsgBox($r['subj'] . ' - sent failed');
        }
    }
    echo "<h2>Send email</h2>";
    foreach ($a as $k => $r) {
        echo '<a href="samples/email.php?send=' . $k . '">' . $r['title'] . '</a><br />';
    }
    return DesignBoxContent("Send Email Example", ob_get_clean(), BX_DB_PADDING_DEF);
}
Beispiel #14
0
function sendMailToAdmin($subject, $content)
{
    global $ADMIN_CONF;
    global $specialchars;
    $from = $specialchars->rebuildSpecialChars($ADMIN_CONF->get("adminmail"), false, false);
    sendMail($subject, $content, $from, $from, $from);
}
Beispiel #15
0
function PageCompPageMainCodeWithForm()
{
    global $oTemplConfig, $site;
    $aForm = array('form_attrs' => array('id' => 'post_us_form', 'action' => BX_DOL_URL_ROOT . 'contact.php', 'method' => 'post'), 'params' => array('db' => array('submit_name' => 'do_submit')), 'inputs' => array('name' => array('type' => 'text', 'name' => 'name', 'caption' => _t('_Your name'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(1, 150), 'error' => _t('_Name is required'))), 'email' => array('type' => 'text', 'name' => 'email', 'caption' => _t('_Your email'), 'required' => true, 'checker' => array('func' => 'email', 'error' => _t('_Incorrect Email'))), 'message_subject' => array('type' => 'text', 'name' => 'subject', 'caption' => _t('_message_subject'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(5, 300), 'error' => _t('_ps_ferr_incorrect_length'))), 'message_text' => array('type' => 'textarea', 'name' => 'body', 'caption' => _t('_Message text'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(10, 5000), 'error' => _t('_ps_ferr_incorrect_length'))), 'captcha' => array('type' => 'captcha', 'caption' => _t('_Enter what you see'), 'name' => 'securityImageValue', 'required' => true, 'checker' => array('func' => 'captcha', 'error' => _t('_Incorrect Captcha'))), 'submit' => array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_Submit'))));
    $oForm = new BxTemplFormView($aForm);
    $sForm = $oForm->getCode();
    $oForm->initChecker();
    if ($oForm->isSubmittedAndValid()) {
        $sSenderName = process_pass_data($_POST['name'], BX_TAGS_STRIP);
        $sSenderEmail = process_pass_data($_POST['email'], BX_TAGS_STRIP);
        $sLetterSubject = process_pass_data($_POST['subject'], BX_TAGS_STRIP);
        $sLetterBody = process_pass_data($_POST['body'], BX_TAGS_STRIP);
        $sLetterBody = $sLetterBody . "\r\n" . '============' . "\r\n" . _t('_from') . ' ' . $sSenderName . "\r\n" . 'with email ' . $sSenderEmail;
        if (sendMail($site['email'], $sLetterSubject, $sLetterBody)) {
            $sActionKey = '_ADM_PROFILE_SEND_MSG';
        } else {
            $sActionKey = '_Email sent failed';
        }
        $sActionText = MsgBox(_t($sActionKey));
        $sForm = $sActionText . $sForm;
    } else {
        $sForm = $oForm->getCode();
    }
    return DesignBoxContent(_t('_CONTACT_H1'), $sForm, $oTemplConfig->PageCompThird_db_num);
}
Beispiel #16
0
 function parse()
 {
     if ($this->user->isLoggedIn()) {
         header("location: " . baseurl(""));
     } else {
         $_POST = removeHTMLFromPOST($_POST);
         $emailCode = md5($_POST['email'] . date("U"));
         $_POST['emailCode'] = $emailCode;
         if (isset($_POST['saveEmail'])) {
             if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) === true) {
                 $_POST['email'] = null;
                 $this->website->assign("emailError", "Ingevulde email was niet valide, ga naar de hoofdpagina en probeer opnieuw te registreren.");
             } else {
                 $emailUsed = $this->db->buildQuery("SELECT email FROM users WHERE email = %s", $_POST['email']);
                 if ($this->db->getHasRows($emailUsed) == 0) {
                     $this->website->assign("email", $_POST['email']);
                     $_SESSION['emailCode'] = $_POST['emailCode'];
                     $this->website->assign("emailVerificationCode", $_POST['emailVerificationCode']);
                     sendMail($_POST['email'], "Uw verificatie code is: " . $emailCode, "Eenmaal andermaal verificatie");
                 } else {
                     $this->website->assign("emailError", "Uw email is al in gebruik genomen.");
                     $emailIsAlreadyUsed = true;
                 }
             }
         }
         $this->addToBreadcrumbs("Home", baseurl(""));
         $this->addToBreadcrumbs("Registratie");
         $this->addToBreadcrumbs("Email Verificatie");
         if ($emailIsAlreadyUsed == false) {
             $this->render("emailVerification", "emailVerification.tpl");
         } else {
             header("location: " . baseurl(""));
         }
     }
 }
 public function requestPassword($key = "")
 {
     if ($key) {
         $key_valid = $this->password_recovery_model->getKey($key);
         //Make sure a key is entered and make sure that it is the right key
         if ($key_valid && $key_valid != '') {
             //Reset password
             $username = $key_valid;
             //Username
             $newPassword = $this->generatePassword();
             //New password
             //Hash password for the database
             $newPasswordHash = sha1(strtoupper($username) . ':' . strtoupper($newPassword));
             //Change the password
             $this->password_recovery_model->changePassword($username, $newPasswordHash);
             //Send a mail with the new password
             sendMail($this->password_recovery_model->getEmail($username), $this->config->item('password_recovery_sender_email'), $this->config->item('server_name') . ': ' . lang("your_new_password", "recovery"), lang("new_password", "recovery") . ' <b>' . $newPassword . '</b>');
             //Show a new message
             $this->template->view($this->template->loadPage("page.tpl", array("module" => "default", "headline" => lang("password_recovery", "recovery"), "content" => lang("changed", "recovery"))));
             //Remove the key from the database
             $this->password_recovery_model->deletekey($key);
         } else {
             //Error occurred
             $this->template->view($this->template->loadPage("page.tpl", array("module" => "default", "headline" => lang("password_recovery", "recovery"), "content" => lang("invalid_key", "recovery"))));
         }
     } else {
         $this->template->view($this->template->loadPage("page.tpl", array("module" => "default", "headline" => lang("password_recovery", "recovery"), "content" => lang("no_key", "recovery"))));
     }
 }
Beispiel #18
0
    public function add()
    {
        $this->data['password'] = mymd5($this->data['password'], $this->data['salt']);
        $email = $this->data['email'];
        //保存
        $id = parent::add();
        if ($id !== false) {
            //>>1.发送激活邮件...
            /*
            * 第一种方式
            
                        $uid = String::uuid();  //保持到数据库中
                        $fireurl = "http://www.shop.com/index.php/Member/fire/key/$uid";
            */
            /*
             * 第二种方式
             */
            $key = mymd5($id, "谁破解是牛逼");
            $fireurl = "http://www.shop.com/index.php/Member/fire/id/{$id}/key/{$key}";
            $content = <<<MAILCONTENT
            <h1>xxx激活邮件</h1>
            <p>点击<a href='{$fireurl}' target='_blank'>这里</a></p>
            <p>请将下面的地址复制到浏览器上</p>
            <p>{$fireurl}<p>
MAILCONTENT;
            sendMail($email, 'xxx激活邮件', $content);
        }
    }
 public function customMessage()
 {
     $arr = I();
     $str = "";
     if ($arr['phone']) {
         if (!preg_match("/1[3458]{1}\\d{9}\$/", $arr['phone'])) {
             $this->resultMsg('error', '请输入正确的电话号码');
         }
         $str = '<br>手机号:' . $arr['phone'];
     }
     if ($arr['email']) {
         if (!preg_match("/[a-zA-Z0-9]+@[a-zA-Z0-9]+\\.[a-z]{2,4}/", $arr['email'])) {
             $this->resultMsg('error', '请输入正确邮箱');
         }
         $str = '<br>邮箱:' . $arr['email'];
     }
     if ($arr['weixin']) {
         $str = '<br>微信:' . $arr['weixin'];
     }
     if (!$arr['name']) {
         $this->resultMsg('error', '请输入名字');
     }
     $customMessage = M('CustomMessage');
     $arr['createtime'] = date('Y-m-d H:i:s');
     $customMessage->data($arr)->add();
     sendMail('*****@*****.**', 'wederful用户定制留言', '用户名:' . $arr['name'] . '<br>目的地:' . $arr['destination'] . '<br>期待婚礼类型:' . $arr['type'] . '<br>亲友人数:' . $arr['number'] . $str);
     $this->resultMsg('success', '提交成功');
 }
function quit($msg)
{
    sendMail($msg);
    echo $msg;
    syslog(LOG_EMERG, $msg);
    exit($msg);
}
Beispiel #21
0
 /**
  *
  */
 public function signup()
 {
     $user = D('User');
     $userinfo = D('Userinfo');
     $value = I('post.');
     /**
     if(!$this->check_verify($value['verify'])){
         $this->error("验证码错误!");
     }
     */
     if (!$userinfo->create($value)) {
         exit($userinfo->getError());
     }
     $userinfo->add();
     if (!$user->create($value)) {
         exit($user->getError());
     }
     $user->add();
     $info = $userinfo->where("email='%s'", $value['email'])->find();
     $content = "请点击以下链接激活账号<br>http://nnow.sinaapp.com/regist/activate/authcode/" . $info['authcode'] . "<br>如果这不是链接请复制到浏览器中打开";
     $title = '激活链接';
     if (!sendMail($value['email'], $title, $content)) {
         exit('邮件发送失败:( 请联系管理员');
     }
     $this->assign('mail', $value['email']);
     $this->display();
 }
Beispiel #22
0
function apiTakingMoreTime($error, $time)
{
    $emailIds = array("*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**");
    foreach ($emailIds as $to) {
        sendMail($to, "Alert! Api Took " . $time, $error);
    }
}
 public function _after_insert($data, $options)
 {
     // 1. 加密userid---base64_encode()
     // 2. 获取token
     // 3. 获取email
     // 4. 拼接激活链接
     // 5. 发送邮件
     //1
     $userID = base64_encode($data['id']);
     //2
     $userToken = $data['token'];
     //3
     $userEmail = $data['email'];
     //4 激活连接
     $url = "<a href='http://www.project-myshop.com/index.php/Home/User/checkReg/id/{$userID}/token/{$userToken}'>请点击后激活</a>";
     //5
     $content = "尊敬用户,{$url}";
     //6 发送邮件
     $result = sendMail($userEmail, '邮箱激活', $content);
     //7 判断返回结果
     if ($result['sign'] == 0) {
         $this->error = $result['msg'];
         return false;
     } else {
         return true;
     }
 }
Beispiel #24
0
 function email_send()
 {
     $open_date = date('Y-m-d');
     $emailuser = '';
     $result = $this->m_announcement->get_announcement_byopen($open_date);
     if ($result) {
         foreach ($result as $value) {
             $colIds = '';
             if (!empty($value->col_ids) && $value->col_ids != null) {
                 $aarycol = explode(',', $value->col_ids);
                 foreach ($aarycol as $colrow) {
                     $colIds[] .= $colrow;
                 }
             }
             $email = $this->m_announcement->get_user_email($colIds);
             foreach ($email as $val) {
                 if (!empty($val->user_email)) {
                     $emailuser .= $val->user_email . ",";
                 }
             }
             $annCount = $value->ann_content;
             $anntitle = $value->ann_title;
             $dt = array(array("from" => $value->user_email, "from_name" => $value->user_email, "to" => $emailuser, "subject" => $anntitle, "message" => $annCount));
             $r = sendMail($dt);
             if ($r) {
                 $value->ann_title;
                 $data = array('ann_status_push' => 2);
                 $this->db->where('ann_id', $value->ann_id);
                 $this->db->update('announcement', $data);
             }
         }
     }
 }
Beispiel #25
0
 public function verify_email()
 {
     //Setting up validation rules for form inputs
     $this->validation_rules = array(array('field' => 'username', 'label' => 'username', 'rules' => 'required|callback_validate_hoteluser', 'class' => 'text-danger'));
     $this->form_validation->set_error_delimiters('<div class="bg-danger">', '</div>');
     $this->form_validation->set_rules($this->validation_rules);
     $this->form_validation->set_message('validate_hoteluser', 'Hotel User with this username is not exist.');
     //$this->form_validation->set_message('valid_email','Please Enter Valid Email.');
     if ($this->form_validation->run() == FALSE) {
         $this->data['action'] = "/login/verify_user";
         $this->template->load('login_tpl', 'recovery_vw', $this->data);
     } else {
         //Get User Id From Email
         $user_info = $this->User_model->get_user_by_name($this->input->post('username'));
         $user_id = $user_info[0]['sb_hotel_user_id'];
         $hotelusername = $user_info[0]['sb_hotel_username'];
         $password = randomPassword();
         $hotel_user_data = array();
         $hotel_user_data['sb_hotel_userpasswd'] = createHashAndSalt($password);
         $result = $this->Hotel_model->edit_hotel_user($hotel_user_data, $user_id);
         $data = array();
         $data['password'] = $password;
         $data['hotelusername'] = $hotelusername;
         $message = $this->load->view('email/forgotpassword', $data, TRUE);
         sendMail('*****@*****.**', $user_info[0]['sb_hotel_useremail'], "Forgot Password", $message);
         $this->session->set_flashdata('SuccMsg', SUC_MSG_LEVEL_2);
         redirect('admin/login');
     }
 }
 public static function send($TemplatePath, $FieldsArr, $Subject, $Recipient, $From = '', $useSmarty = true)
 {
     global $Global;
     global $Smarty;
     $Settings = new Settings();
     if ($From == "") {
         $From = $Global->Settings->AdminEmail;
     }
     if ($useSmarty == true) {
         $Smarty->setTemplateDir(EMAIL_TPL_PATH);
         foreach ($FieldsArr as $key => $value) {
             $Smarty->assign($key, $value);
         }
         $content = $Smarty->fetch($TemplatePath);
     } else {
         $fh = fopen($TemplatePath, 'r');
         $content = fread($fh, filesize($TemplatePath));
         foreach ($FieldsArr as $key => $value) {
             $content = str_replace("##" . $key . "##", $value, $content);
         }
     }
     # Send Mail
     sendMail($Recipient, $Subject, $content, $From);
     # Set Smarty back to correct Template Directory
     $Smarty->setTemplateDir(TPL_DIR);
 }
 function processing()
 {
     $oModules = new BxDolModuleDb();
     $aModules = $oModules->getModules();
     $aResult = array();
     foreach ($aModules as $aModule) {
         $aCheckInfo = BxDolInstallerUi::checkForUpdates($aModule);
         if (isset($aCheckInfo['version'])) {
             $aResult[] = _t('_adm_txt_modules_update_text_ext', $aModule['title'], $aCheckInfo['version']);
         }
     }
     if (empty($aResult)) {
         return;
     }
     $aAdmins = $GLOBALS['MySQL']->getAll("SELECT * FROM `Profiles` WHERE `Role`&" . BX_DOL_ROLE_ADMIN . "<>0 AND `EmailNotify`='1'");
     if (empty($aAdmins)) {
         return;
     }
     $oEmailTemplate = new BxDolEmailTemplates();
     $sMessage = implode('<br />', $aResult);
     foreach ($aAdmins as $aAdmin) {
         $aTemplate = $oEmailTemplate->getTemplate('t_ModulesUpdates', $aAdmin['ID']);
         sendMail($aAdmin['Email'], $aTemplate['Subject'], $aTemplate['Body'], $aAdmin['ID'], array('MessageText' => $sMessage));
     }
 }
Beispiel #28
0
function updatePassword($mysqli, $userId)
{
    if (isset($_POST['submit3'])) {
        if (!empty($_POST['oldpw']) && !empty($_POST['newpw1']) && !empty($_POST['newpw2'])) {
            $getOldPw = $mysqli->query("SELECT email, password FROM users WHERE id = '{$userId}' ");
            $userArray = $getOldPw->fetch_array();
            $email = $userArray['email'];
            $password = $userArray['password'];
            if (md5($_POST['oldpw']) == $password) {
                if (strlen($_POST['newpw1']) > 7) {
                    if ($_POST['newpw1'] == $_POST['newpw2']) {
                        $newPassword = md5(trim(htmlentities($_POST['newpw1'], ENT_QUOTES, "UTF-8")));
                        $date = date('Y-m-d H:i:s');
                        $update = $mysqli->query("UPDATE users SET password = '******', modified = '{$date}' \r\n\t\t\t\t\t\t                          WHERE id = {$userId} ");
                        if (sendMail($email) === true) {
                            return 1;
                        } else {
                            return 2;
                        }
                    } else {
                        return "Ihr neues Passwort und die Passwortwiederholung stimmen nicht überein.";
                    }
                } else {
                    return "Ihr neues Passwort muss aus mindesten 8 Zeichen bestehen.";
                }
            } else {
                return "Ihr altes Passwort ist falsch.";
            }
        } else {
            return "Sie haben nicht alle Passwortfelder ausgefüllt.";
        }
    }
}
Beispiel #29
0
/**
 * send "tell a friend" email
 */
function SendTellFriend($iSenderID = 0)
{
    global $profileID;
    $sRecipient = clear_xss($_POST['friends_emails']);
    $sSenderName = clear_xss($_POST['name']);
    $sSenderEmail = clear_xss($_POST['email']);
    if (strlen(trim($sRecipient)) <= 0) {
        return 0;
    }
    if (strlen(trim($sSenderEmail)) <= 0) {
        return 0;
    }
    $sLinkAdd = $iSenderID > 0 ? 'idFriend=' . $iSenderID : '';
    $rEmailTemplate = new BxDolEmailTemplates();
    if ($profileID) {
        $aTemplate = $rEmailTemplate->getTemplate('t_TellFriendProfile', $profileID);
        $Link = getProfileLink($profileID, $sLinkAdd);
    } else {
        $aTemplate = $rEmailTemplate->getTemplate('t_TellFriend');
        $Link = BX_DOL_URL_ROOT;
        if (strlen($sLinkAdd) > 0) {
            $Link .= '?' . $sLinkAdd;
        }
    }
    $aPlus = array('Link' => $Link, 'FromName' => $sSenderName);
    return sendMail($sRecipient, $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus);
}
/**
 * page code function
 */
function PageCompPageMainCode($iID, $sConfCode)
{
    global $site;
    $ID = (int) $iID;
    $ConfCode = clear_xss($sConfCode);
    $p_arr = getProfileInfo($ID);
    if (!$p_arr) {
        $_page['header'] = _t("_Error");
        $_page['header_text'] = _t("_Profile Not found");
        return MsgBox(_t('_Profile Not found Ex'));
    }
    $aCode = array('message_status' => '', 'message_info' => '', 'bx_if:form' => array('condition' => false, 'content' => array('form' => '')), 'bx_if:next' => array('condtion' => false, 'content' => array('next_url' => '')));
    if ($p_arr['Status'] == 'Unconfirmed') {
        $ConfCodeReal = base64_encode(base64_encode(crypt($p_arr[Email], CRYPT_EXT_DES ? "secret_co" : "se")));
        if (strcmp($ConfCode, $ConfCodeReal) != 0) {
            $aForm = array('form_attrs' => array('action' => BX_DOL_URL_ROOT . 'profile_activate.php', 'method' => 'post', 'name' => 'form_change_status'), 'inputs' => array('conf_id' => array('type' => 'hidden', 'name' => 'ConfID', 'value' => $ID), 'conf_code' => array('type' => 'text', 'name' => 'ConfCode', 'value' => '', 'caption' => _t("_Confirmation code")), 'submit' => array('type' => 'submit', 'name' => 'submit', 'value' => _t("_Submit"))));
            $oForm = new BxTemplFormView($aForm);
            $aCode['message_status'] = _t("_Profile activation failed");
            $aCode['message_info'] = _t("_EMAIL_CONF_FAILED_EX");
            $aCode['bx_if:form']['condition'] = true;
            $aCode['bx_if:form']['content']['form'] = $oForm->getCode();
        } else {
            $aCode['bx_if:next']['condition'] = true;
            $aCode['bx_if:next']['content']['next_url'] = BX_DOL_URL_ROOT . 'member.php';
            $send_act_mail = false;
            if (getParam('autoApproval_ifJoin') == 'on' && !(getParam('sys_dnsbl_enable') && 'approval' == getParam('sys_dnsbl_behaviour') && bx_is_ip_dns_blacklisted('', 'join'))) {
                $status = 'Active';
                $send_act_mail = true;
                $aCode['message_info'] = _t("_PROFILE_CONFIRM");
            } else {
                $status = 'Approval';
                $aCode['message_info'] = _t("_EMAIL_CONF_SUCCEEDED", $site['title']);
            }
            $update = bx_admin_profile_change_status($ID, $status, $send_act_mail);
            // Promotional membership
            if (getParam('enable_promotion_membership') == 'on') {
                $memership_days = getParam('promotion_membership_days');
                setMembership($p_arr['ID'], MEMBERSHIP_ID_PROMOTION, $memership_days, true);
            }
            // check couple profile;
            if ($p_arr['Couple']) {
                $update = bx_admin_profile_change_status($p_arr['Couple'], $status);
                //Promotional membership
                if (getParam('enable_promotion_membership') == 'on') {
                    $memership_days = getParam('promotion_membership_days');
                    setMembership($p_arr['Couple'], MEMBERSHIP_ID_PROMOTION, $memership_days, true);
                }
            }
            if (getParam('newusernotify')) {
                $oEmailTemplates = new BxDolEmailTemplates();
                $aTemplate = $oEmailTemplates->getTemplate('t_UserConfirmed', $p_arr['ID']);
                sendMail($site['email_notify'], $aTemplate['Subject'], $aTemplate['Body'], $p_arr['ID']);
            }
        }
    } else {
        $aCode['message_info'] = _t('_ALREADY_ACTIVATED');
    }
    return $GLOBALS['oSysTemplate']->parseHtmlByName('profile_activate.html', $aCode);
}