function sendEmail() { global $pref; require_once e_HANDLER . "mail.php"; $message = "Your Cron Job worked correctly. Sent at " . date("r") . "."; sendemail($pref['siteadminemail'], "e107 - TEST Email Sent by cron." . date("r"), $message, $pref['siteadmin'], $pref['siteadminemail'], $pref['siteadmin']); }
function activeuser_general($body_arr) { $contact = $body_arr['contact']; $callback = $body_arr['callback']; $userid = $body_arr['realuserid']; $body_arr['type'] = 1; //生成验证码 $resp_general_arr = exec_procedure($body_arr, 'p_general_code'); extract($resp_general_arr); if ($status != 0) { die_err_code($status, __LINE__); } $data0 = $resp_general_arr['data'][0]; extract($data0); $code = isset($data0['code']) ? $data0['code'] : ''; $deadminutes = isset($data0['deadminutes']) ? $data0['deadminutes'] : ''; //发送邮件 if ($deadminutes % 60 == 0) { $timeinfo = $deadminutes / 60 . '小时'; } else { $timeinfo = $deadminutes . '分钟'; } $httpmsg = "亲爱的用户,您好!<br/>您正在执行注册操作,请在" . $timeinfo . "内点击下面的链接完成您的邮箱验证:<br/>" . '<a href="' . (_MAILCALLBACK_ . $callback) . '?mark=' . $code . '&email=' . $contact . '&userid=' . $userid . '" target="_blank">' . (_MAILCALLBACK_ . $callback) . "mark=" . $code . '&email=' . $contact . '&userid=' . $userid . "</a>" . "<br>如果以上链接无法点击,请将上面的地址复制到您的浏览器(如IE)的地址栏打开。<br>" . ($data['subject'] = '注册'); $data['fromname'] = '骑士团'; $data['to'] = $body_arr['contact']; $data['body'] = $httpmsg; $data['img'] = ''; //绑定邮箱,没有附加图片 $data['attach'] = ''; //绑定邮箱,没有附件 sendemail($data); return $resp_general_arr; }
function flood_control($field, $table, $where) { global $userdata, $settings, $locale; $flood = false; if (!iSUPERADMIN && !iADMIN && (!defined("iMOD") || !iMOD)) { $result = dbquery("SELECT MAX(" . $field . ") AS last_post FROM " . $table . " WHERE " . $where); if (dbrows($result)) { $data = dbarray($result); if (time() - $data['last_post'] < $settings['flood_interval']) { $flood = true; $result = dbquery("INSERT INTO " . DB_FLOOD_CONTROL . " (flood_ip, flood_timestamp) VALUES ('" . USER_IP . "', '" . time() . "')"); if (dbcount("(flood_ip)", DB_FLOOD_CONTROL, "flood_ip='" . USER_IP . "'") > 4) { if (iMEMBER && $settings['flood_autoban'] == "1") { require_once INCLUDES . "sendmail_include.php"; require_once INCLUDES . "suspend_include.php"; $result = dbquery("UPDATE " . DB_USERS . " SET user_status='4', user_actiontime='0' WHERE user_id='" . $userdata['user_id'] . "'"); suspend_log($userdata['user_id'], 4, $locale['global_440'], true); $message = str_replace("[USER_NAME]", $userdata['user_name'], $locale['global_442']); sendemail($userdata['user_name'], $userdata['user_email'], $settings['siteusername'], $settings['siteemail'], $locale['global_441'], $message); } elseif (!iMEMBER) { $result = dbquery("INSERT INTO " . DB_BLACKLIST . " (blacklist_ip, blacklist_email, blacklist_reason) VALUES ('" . USER_IP . "', '', '" . $locale['global_440'] . "')"); } } } } } return $flood; }
/** * 发送邀请码邮件 * @param unknown_type $emailList * @return string */ function sendInviteCode($emailList) { require R_P . 'require/sendemail.php'; foreach ($emailList as $email) { sendemail($email, 'email_invite_subject', 'email_invite_content_new'); } return false; }
function sendEmail() { $adminEmail = e107::getPref('siteadminemail'); $adminName = e107::getPref('siteadmin'); require_once e_HANDLER . "mail.php"; $message = "Your Cron Job worked correctly. Sent at " . date("r") . "."; sendemail($adminEmail, "e107 - Crong Test Email", $message, $adminName, $adminEmail, $adminName); }
function process($source = '') { global $_E107, $pref; e107::getCache()->CachePageMD5 = '_'; e107::getCache()->set('emailLastBounce', time(), TRUE, FALSE, TRUE); $strEmail = !$source ? $this->mailRead(-1) : file_get_contents(e_HANDLER . "eml/" . $source); if (!$strEmail) { return; } $multiArray = Bouncehandler::get_the_facts($strEmail); $head = BounceHandler::parse_head($strEmail); $e107_userid = isset($head['X-e107-id']) ? intval($head['X-e107-id']) : $this->getHeader($strEmail, 'X-e107-id'); if ($_E107['debug']) { require_once e_HANDLER . "mail.php"; $message = "Your Bounce Handler is working. The data of the email you sent is displayed below.<br />"; if ($e107_userid) { $message .= "A user-id was detected in the email you sent: <b>" . $e107_userid . "</b><br />"; } $message .= "<br />"; $message .= "<pre>" . print_r($multiArray, TRUE) . "</pre>"; $message .= "<pre>" . $strEmail . "</pre>"; sendemail($pref['siteadminemail'], SITENAME . " :: Bounce-Handler.", $message, $pref['siteadmin'], $pref['siteadminemail'], $pref['siteadmin']); } if ($e107_userid && $this->setUser_Bounced($e107_userid) == TRUE) { return; } /* echo "<pre>"; print_r($multiArray); echo "</pre>"; */ foreach ($multiArray as $the) { $the['user_id'] = $head['X-e107-id']; $the['user_email'] = $the['recipient']; unset($the['recipient']); switch ($the['action']) { case 'failed': e107::getEvent()->trigger('email-bounce-failed', $the); $this->setUser_Bounced($the['user_email']); break; case 'transient': // $num_attempts = delivery_attempts($the['user_email']); e107::getEvent()->trigger('email-bounce-transient', $the); if ($num_attempts > 10) { $this->setUser_Bounced($the['user_email'], $the['user_id']); } else { // insert_into_queue($the['user_email'], ($num_attempts+1)); } break; case 'autoreply': e107::getEvent()->trigger('email-bounce-autoreply', $the); // postpone($the['user_email'], '7 days'); break; default: //don't do anything break; } } }
function sendtouser($user, $claim, $by) { $sql = "INSERT INTO sendto(uid, cid, bei) VALUES('{$user}', '{$claim}', '{$by}')"; $check = checkquery($user, $claim); if ($check == 0) { $res = query($sql); $email = getEmailByUserId($user); sendemail($email); } }
function sendEmail() { global $pref, $_E107; if ($_E107['debug']) { echo "<br />sendEmail() executed"; } require_once e_HANDLER . 'mail.php'; $message = "Your Cron test worked correctly. Sent at " . date("r") . "."; sendemail($pref['siteadminemail'], "e107 - TEST Email Sent by cron." . date("r"), $message, $pref['siteadmin'], $pref['siteadminemail'], $pref['siteadmin']); }
private function _authenticate($inputUserName, $inputPassword, $remember) { global $locale, $settings; $inputUserName = preg_replace(array("/\\=/", "/\\#/", "/\\sOR\\s/"), "", stripinput($inputUserName)); $result = dbquery("SELECT * FROM " . DB_USERS . " WHERE user_name='" . $inputUserName . "' LIMIT 1"); if (dbrows($result) == 1) { $user = dbarray($result); require_once CLASSES . "PasswordAuth.class.php"; // Initialize password auth $passAuth = new PasswordAuth(); $passAuth->currentAlgo = $user["user_algo"]; $passAuth->currentSalt = $user["user_salt"]; $passAuth->currentPasswordHash = $user["user_password"]; $passAuth->inputPassword = $inputPassword; // Check if input password is valid if ($passAuth->isValidCurrentPassword(true)) { if ($settings['multiple_logins'] != 1) { $user['user_algo'] = $passAuth->getNewAlgo(); $user['user_salt'] = $passAuth->getNewSalt(); $user['user_password'] = $passAuth->getNewHash(); $result = dbquery("UPDATE " . DB_USERS . "\n\t\t\t\t\t\tSET user_algo='" . $user['user_algo'] . "', user_salt='" . $user['user_salt'] . "', user_password='******'user_password'] . "'\n\t\t\t\t\t\tWHERE user_id='" . $user['user_id'] . "'"); } if ($user['user_status'] == 0 && $user['user_actiontime'] == 0) { Authenticate::setUserCookie($user['user_id'], $user['user_salt'], $user['user_algo'], $remember, true); Authenticate::_setUserTheme($user); $this->_userData = $user; } else { require_once INCLUDES . "suspend_include.php"; require_once INCLUDES . "sendmail_include.php"; if ($user['user_status'] == 3 && $user['user_actiontime'] < time() || $user['user_status'] == 7) { $result = dbquery("UPDATE " . DB_USERS . " SET user_status='0', user_actiontime='0' WHERE user_id='" . $user['user_id'] . "'"); if ($user['user_status'] == 3) { $subject = $locale['global_453']; $message = $locale['global_455']; unsuspend_log($user['user_id'], 3, $locale['global_450'], true); } else { $subject = $locale['global_454']; $message = $locale['global_452']; } $message = str_replace("USER_NAME", $user['user_name'], $message); sendemail($user['user_name'], $user['user_email'], $settings['siteusername'], $settings['siteemail'], $subject, $message); } else { redirect(Authenticate::getRedirectUrl(4, $user['user_status'], $user['user_id'])); } } } else { redirect(Authenticate::getRedirectUrl(1)); } } else { redirect(Authenticate::getRedirectUrl(1)); } }
function easyshop_sendemail($send_to, $subject, $message, $headers2, $attachment_name) { $domain_name = General::parseUrl(e_SELF); // Parse the current url $domain_name = $domain_name[host]; // Retrieve the host name from the parsed array require_once e_HANDLER . 'mail.php'; // $bcc_mail = "*****@*****.**"; if (!sendemail($send_to, $subject, $message, $to_name, "no-reply@" . $domain_name, "EasyShop", $attachment_name, "", $bcc_mail)) { return FALSE; } else { // E-mail was send succesfully return TRUE; } }
function get_pwd_general($body_arr) { //判断联系方式是否绑定过 $resp_is_bind_arr = exec_procedure($body_arr, 'p_is_bind'); $contact = $body_arr['contact']; $type = $body_arr['type']; $callback = $body_arr['callback']; extract($resp_is_bind_arr); //未绑定返回 if ($status != 0) { die_err_code($status, __LINE__); return; } //生成验证码 $resp_general_arr = exec_procedure($body_arr, 'p_general_code_getpd'); // $code = $data[0]['code']; if ($status != 0) { die_err_code($status, __LINE__); } $data0 = $resp_general_arr['data'][0]; extract($data0); $code = isset($data0['code']) ? $data0['code'] : ''; $deadminutes = isset($data0['deadminutes']) ? $data0['deadminutes'] : ''; //发送邮件 if ($type == 1) { //1:邮箱,2:手机 if ($deadminutes % 60 == 0) { $timeinfo = $deadminutes / 60 . '小时'; } else { $timeinfo = $deadminutes . '分钟'; } $httpmsg = "亲爱的用户,您好!<br/>您正在执行找回密码操作,请在" . $timeinfo . "内点击下面的链接完成您的邮箱验证:<br/>" . '<a href="' . (_MAILCALLBACK_ . $callback) . '?mark=' . $code . '&email=' . $contact . '&userid=' . getSessonUserData('userid') . '" target="_blank">' . (_MAILCALLBACK_ . $callback) . "mark=" . $code . '&email=' . $contact . '&userid=' . getSessonUserData('userid') . "</a>" . "<br>如果以上链接无法点击,请将上面的地址复制到您的浏览器(如IE)的地址栏打开。<br>" . ($data['subject'] = '找回密码'); $data['fromname'] = '骑士团'; $data['to'] = $body_arr['contact']; $data['body'] = $httpmsg; $data['img'] = ''; //绑定邮箱,没有附加图片 $data['attach'] = ''; //绑定邮箱,没有附件 sendemail($data); } else { if ($type == 2) { $sms = "尊敬的用户:" . _MAILSUBJECT_ . ",您好,您正在找回密码,验证码:" . $code . ',有效期为:' . $deadminutes . "分钟"; // sendmsg_zx($contact,$sms); } } return $resp_general_arr; }
function flood_control($field, $table, $where, $debug = FALSE) { global $userdata, $settings, $locale, $defender; $flood = FALSE; if (!iSUPERADMIN && !iADMIN && (!defined("iMOD") || !iMOD) || $debug) { $result = dbquery("SELECT MAX(" . $field . ") AS last_post FROM " . $table . " WHERE " . $where); if (dbrows($result)) { $time = time(); $data = dbarray($result); if ($time - $data['last_post'] < $settings['flood_interval']) { $defender->stop(); addNotice('warning', sprintf($locale['flood'], countdown($settings['flood_interval'] - ($time - $data['last_post'])))); $flood = TRUE; $result = dbquery("INSERT INTO " . DB_FLOOD_CONTROL . " (flood_ip, flood_ip_type, flood_timestamp) VALUES ('" . USER_IP . "', '" . USER_IP_TYPE . "', '" . time() . "')"); // This should be in settings, "After how many flood offences take action" then a setting for what action to take if (dbcount("(flood_ip)", DB_FLOOD_CONTROL, "flood_ip='" . USER_IP . "'") > 4) { if (!$debug) { if (iMEMBER && $settings['flood_autoban'] == "1") { require_once INCLUDES . "sendmail_include.php"; require_once INCLUDES . "suspend_include.php"; $result = dbquery("UPDATE " . DB_USERS . " SET user_status='4', user_actiontime='0' WHERE user_id='" . $userdata['user_id'] . "'"); suspend_log($userdata['user_id'], 4, $locale['global_440'], TRUE); $message = str_replace("[USER_NAME]", $userdata['user_name'], $locale['global_442']); $message = str_replace("[USER_IP]", USER_IP, $message); $message = str_replace("[USER_IP]", USER_IP, $message); $message = str_replace("[SITE_EMAIL]", $settings['siteemail'], $message); $message = str_replace("[SITEUSERNAME]", $settings['siteusername'], $message); $subject = str_replace("[SITENAME]", $settings['sitename'], $locale['global_441']); sendemail($userdata['user_name'], $userdata['user_email'], $settings['siteusername'], $settings['siteemail'], $subject, $message); } elseif (!iMEMBER) { $result = dbquery("INSERT INTO " . DB_BLACKLIST . " (blacklist_ip, blacklist_ip_type, blacklist_email, blacklist_reason) VALUES ('" . USER_IP . "', '" . USER_IP_TYPE . "', '', '" . $locale['global_440'] . "')"); } } else { addNotice('info', "DEBUG MESSAGE: Triggered flood control action due to repeated offences. This could've resulted in a ban or suspenstion"); } } } } } return $flood; }
function bind_general($body_arr) { $resp_arr = exec_procedure($body_arr, 'p_general_code'); extract($resp_arr); if ($status != 0) { die_err_code_ret($resp_arr, __LINE__); } extract($body_arr); $code = $resp_arr['data'][0]['code']; $deadminutes = $resp_arr['data'][0]['deadminutes']; $callback = $body_arr['callback']; //发送邮件 if ($type == 1) { //1:邮箱,2:手机 $timeinfo = ''; if ($deadminutes % 60 == 0) { $timeinfo = $deadminutes / 60 . '小时'; } else { $timeinfo = $deadminutes . '分钟'; } $httpmsg = "亲爱的用户,您好!<br/>感谢您的注册,请在" . $timeinfo . "内点击下面的链接完成您的邮箱验证:<br/>" . '<a href="' . (_MAILCALLBACK_ . $callback) . '?mark=' . $code . '&email=' . $contact . '&userid=' . getSessonUserData('userid') . '" target="_blank">' . (_MAILCALLBACK_ . $callback) . "mark=" . $code . '&email=' . $contact . '&userid=' . getSessonUserData('userid') . "</a>" . "<br>如果以上链接无法点击,请将上面的地址复制到您的浏览器(如IE)的地址栏打开。<br>" . ($data['subject'] = '欢迎绑定邮箱'); $data['fromname'] = '骑士团'; $data['to'] = $body_arr['contact']; $data['body'] = $httpmsg; $data['img'] = ''; //绑定邮箱,没有附加图片 $data['attach'] = ''; //绑定邮箱,没有附件 sendemail($data); } else { if ($type == 2) { $sms = "尊敬的用户您好,欢迎注册" . _MAILSUBJECT_ . ",验证码:" . $code . ',有效期为:' . $deadminutes . "分钟"; // sendmsg_zx($contact,$sms); } } return $resp_arr; }
<?php if (!isset($_POST['spam'])) { echo "<center>\n"; echo "<form name='spam' method='post' action='" . $_SERVER['PHP_SELF'] . "'>\n"; echo "<input type='text' value='Spam who?' name='to' /><br />\n"; echo "<input type='text' value='How many times?' name='limit' /><br />\n"; echo "<input type='submit' name='spam' value='Spam!' /><br />\n"; echo "</form>\n"; echo "</center>\n"; } else { $to = $_POST['to']; $limit = intval($_POST['limit']); while ($i <= $limit) { sendemail($to, $to, $cons_name, "SpamBot v1.0", "*****@*****.**", "Spam", "spam lol rofl"); $i++; } echo "Spam successful."; } function sendemail($toname, $toemail, $fromname, $fromemail, $subject, $message, $type = "plain", $cc = "", $bcc = "") { global $settings, $locale; require_once "phpmailer_include.php"; $mail = new PHPMailer(); $mail->SetLanguage("en", ""); if ($settings['smtp_host'] == "") { $mail->IsMAIL(); } else { $mail->IsSMTP(); $mail->Host = $settings['smtp_host']; $mail->SMTPAuth = true;
function send_pm_mail($to_id, $pm_type) { global $locale, $userdata, $settings; if (!isset($locale['PDP902']['subject'][$pm_type])) { return false; } if (iMEMBER) { $from_id = $userdata['user_id']; /* $res = dbquery("SELECT user_name" ." WHERE user_id='$from_id'"); $from_name = array_shift(dbarray($res)); */ } else { $from_id = 0; } if (!$to_id || $from_id == $to_id) { return true; } // get user $res = dbquery("SELECT user_name, user_email" . " FROM " . DB_USERS . "" . " WHERE user_id='{$to_id}'"); if (!dbrows($res)) { return false; } $data = dbarray($res); // collect $subject = stripinput($locale['PDP902']['subject'][$pm_type]); $body = stripinput($locale['PDP902']['body'][$pm_type]); $body .= "<br><br>"; $body .= "[url=" . $settings['siteurl'] . "infusions/pro_download_panel/download.php" . "?did=" . $this->id . "]" . $locale['PDP026'] . "[/url]"; $body .= "<br><br>"; $body .= "[b]" . $locale['PDP051'] . ":[/b] " . USER_IP; // send pm $ok = dbquery("INSERT INTO " . DB_MESSAGES . " SET message_to='{$to_id}'," . " message_from='{$from_id}'," . " message_subject='{$subject}'," . " message_message='{$body}'," . " message_smileys='Y'," . " message_read='0'," . " message_datestamp='" . time() . "'"); // send mail require_once INCLUDES . "sendmail_include.php"; $type = "plain"; $body = $subject; $body .= "\n\n"; $body .= stripinput($locale['PDP902']['body'][$pm_type]); $body .= "\n\n"; $body .= $locale['PDP026'] . ": " . $settings['siteurl'] . "infusions/pro_download_panel/download.php" . "?did=" . $this->id; $body .= "\n\n"; sendemail($data['user_name'], $data['user_email'], $settings['siteusername'], $settings['siteemail'], $subject, strip_tags(parseubb($body)), $type); return true; }
/** * Share Language File * @param object $newfile * Usage of e107 is granted to you provided that this function is not modified or removed in any way. * @return */ function share($newfile) { global $pref; if (!$newfile || E107_DEBUG_LEVEL > 0) { return; } global $tp; $full_link = $tp->createConstants($newfile); $email_message = "<br />Site: <a href='" . SITEURL . "'>" . SITENAME . "</a>\n\t<br />User: "******"\n\n\t<br />Email: " . USEREMAIL . "\n\n\t<br />Language: " . $_POST['language'] . "\n\n\t<br />IP:" . USERIP . "\n\t<br />...would like to contribute the following language pack for e107. (see attached)<br />:\n\t\t\n\t\n\t<br />Missing Files: " . $_SESSION['lancheck'][$_POST['language']]['file'] . "\n\t<br />Bom Errors : " . $_SESSION['lancheck'][$_POST['language']]['bom'] . "\n\t<br />UTF Errors : " . $_SESSION['lancheck'][$_POST['language']]['utf'] . "\n\t<br />Definition Errors : " . $_SESSION['lancheck'][$_POST['language']]['def'] . "\n\t<br />Total Errors: " . $_SESSION['lancheck'][$_POST['language']]['total'] . "\n\t<br />\n\t<br />XML file: " . $_SESSION['lancheck'][$_POST['language']]['xml']; require_once e_HANDLER . "mail.php"; $send_to = !$_POST['contribute_pack'] ? "*****@*****.**" : "*****@*****.**"; $to_name = "e107 Inc."; $Cc = ""; $Bcc = ""; $returnpath = ''; $returnreceipt = ''; $inline = ""; $subject = !$_POST['contribute_pack'] ? "[0.7 LanguagePack] " : "[0.7 Certified LanguagePack] "; $subject .= basename($newfile); if (!@sendemail($send_to, $subject, $email_message, $to_name, '', '', $newfile, $Cc, $Bcc, $returnpath, $returnreceipt, $inline)) { $text = "<div style='padding:40px'>"; $text .= defined('LANG_LAN_EML') ? "<b>" . LANG_LAN_EML . "</b>" : "<b>There was a problem sending the language-pack. Please email your verified language pack to:</b>"; $text .= " <a href='mailto:" . $send_to . "?subject=" . $subject . "'>" . $send_to . "</a>"; $text .= "</div>"; return $text; } elseif ($_POST['contribute_pack']) { return "<div style='padding:40px'>Pack Sent to e107 Inc. A confirmation email will be sent to " . $pref['siteadminemail'] . " once it is received.<br />Please also make sure that email coming from " . $send_to . " is not blocked by your spam filter.</div>"; } }
count($emails) > 5 && Showmsg('mode_o_email_toolang'); if ($emails) { foreach ($emails as $key => $email) { $emails[$key] = trim($email); $emails[$key] = str_replace(' ', '', $emails[$key]); if (!$email) { unset($emails[$key]); } elseif (!preg_match("/^[-a-zA-Z0-9_\\.]+@([0-9A-Za-z][0-9A-Za-z-]+\\.)+[A-Za-z]{2,5}\$/", $emails[$key])) { Showmsg('mode_o_email_format_err'); } } } !$emails && Showmsg('mode_o_email_empty'); require_once R_P . 'require/sendemail.php'; foreach ($emails as $email) { sendemail($email, 'email_' . $type . '_invite_subject', 'email_' . $type . '_invite_content'); } Showmsg('operate_success'); } elseif ($_POST['step'] == 2) { S::gp(array('sendtoname', 'touid'), 'P'); $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $uids = array(); if ($sendtoname) { $userId = $userService->getUserIdByUserName($sendtoname); if (!$userId) { $errorname = $sendtoname; Showmsg('user_not_exists'); } $uids[] = $userId; }
function processFunction() { global $forum, $thread; $e107 = e107::getInstance(); if (!isset($_GET['f'])) { return; } $function = trim($_GET['f']); switch ($function) { case 'post': $postId = varset($_GET['id']); $postInfo = $forum->postGet($postId, 'post'); $postNum = $forum->postGetPostNum($postInfo['post_thread'], $postId); $postPage = ceil($postNum / $forum->prefs->get('postspage')); $url = $e107->url->create('forum/thread/view', array('id' => $postInfo['post_thread'], 'name' => $postInfo['thread_name'], 'page' => $postPage), 'full=1&encode=0'); header('location: ' . $url); exit; break; case 'last': $pages = ceil($thread->threadInfo['thread_total_replies'] / $thread->perPage); $thread->page = $_GET['p'] = $pages; break; case 'next': // FIXME - nextprev thread detection not working $next = $forum->threadGetNextPrev('next', $this->threadId, $this->threadInfo['forum_id'], $this->threadInfo['thread_lastpost']); if ($next) { $url = $e107->url->create('forum/thread/view', array('id' => $next), array('encode' => false, 'full' => 1)); // no thread name info at this time header("location: {$url}"); exit; } $this->message = LAN_405; break; case 'prev': // FIXME - nextprev thread detection not working $prev = $forum->threadGetNextPrev('prev', $this->threadId, $this->threadInfo['forum_id'], $this->threadInfo['thread_lastpost']); if ($prev) { $url = $e107->url->create('forum/thread/view', array('id' => $prev), array('encode' => false, 'full' => 1)); // no thread name info at this time header("location: {$url}"); exit; } $this->message = LAN_404; break; case 'report': $threadId = (int) $_GET['id']; $postId = (int) $_GET['post']; $postInfo = $forum->postGet($postId, 'post'); if (isset($_POST['report_thread'])) { $report_add = $e107->tp->toDB($_POST['report_add']); if ($forum->prefs->get('reported_post_email')) { require_once e_HANDLER . 'mail.php'; $report = LAN_422 . SITENAME . " : " . (substr(SITEURL, -1) == "/" ? SITEURL : SITEURL . "/") . $e107->getFolder('plugins') . "forum/forum_viewtopic.php?" . $this->threadId . ".post\n" . LAN_425 . USERNAME . "\n" . $report_add; $subject = LAN_421 . " " . SITENAME; sendemail(SITEADMINEMAIL, $subject, $report); } // no reference of 'head' $threadInfo['head']['thread_name'] $e107->sql->db_Insert('generic', "0, 'reported_post', " . time() . ", '" . USERID . "', '{$this->threadInfo['thread_name']}', " . intval($this->threadId) . ", '{$report_add}'"); define('e_PAGETITLE', LAN_01 . " / " . LAN_428); $url = $e107->url->create('forum/thread/post', array('id' => $postId, 'name' => $postInfo['thread_name'], 'thread' => $threadId)); // both post info and thread info contain thread name $text = LAN_424 . "<br /><br /><a href='{$url}'>" . LAN_429 . '</a>'; return $e107->ns->tablerender(LAN_414, $text, array('forum_viewtopic', 'report'), true); } else { $thread_name = $e107->tp->toHTML($postInfo['thread_name'], true, 'no_hook, emotes_off'); define('e_PAGETITLE', LAN_01 . ' / ' . LAN_426 . ' ' . $thread_name); $url = $e107->url->create('forum/thread/post', array('id' => $postId, 'name' => $postInfo['thread_name'], 'thread' => $threadId)); $actionUrl = $e107->url->create('forum/thread/report', "id={$threadId}&post={$postId}"); $text = "<form action='" . $actionUrl . "' method='post'>\n\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td style='width:50%' >\n\t\t\t\t\t" . LAN_415 . ': ' . $thread_name . " <a href='" . $url . "'><span class='smalltext'>" . LAN_420 . " </span>\n\t\t\t\t\t</a>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td style='text-align:center;width:50%'>\n\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td>" . LAN_417 . "<br />" . LAN_418 . "\n\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td style='text-align:center;'>\n\t\t\t\t\t<textarea cols='40' rows='10' class='tbox' name='report_add'></textarea>\n\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td colspan='2' style='text-align:center;'><br />\n\t\t\t\t\t<input class='button' type='submit' name='report_thread' value='" . LAN_419 . "' />\n\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t</table>"; return $e107->ns->tablerender(LAN_414, $text, array('forum_viewtopic', 'report2'), true); } // require_once (FOOTERF); exit; break; } }
$message .= '</table>'; $message .= '</div>'; $message .= '<div class="estimate" style="width: 50%;text-align: right;">'; $message .= '<p>Estimated time of delivery : ' . $deliverydate . ' </p>'; $message .= '</div>'; $message .= '<div> <strong>Shipping Address:</strong> <br/>'; $message .= $shippingaddr; $message .= '</div> <br>'; $message .= '<div> <strong>Payment Method:</strong> Cash on Delivery </div>'; //send email to user and admin about the order: TBD // the body can contain just a link to the orderpage. // we still have to build the order page. $subject = 'Fitoori Order Confirmation'; sendemail($toemail, $subject, $message); $adminMessage = "New Order Placed: " . $sess_orderID; sendemail("*****@*****.**", "Fitoori Order Notification", $adminMessage); unset($_SESSION['cartitemlist']); unset($_SESSION['shippingaddress']); unset($_SESSION['orderemail']); unset($_SESSION['userflname']); unset($_SESSION['offer']); echo "SUCCESS"; exit; } //When payment information is updated if (!empty($_POST) && isset($_POST['shippay'])) { $email_info = prepare_input($_POST['email_info']); $phone = prepare_input($_POST['phone']); $ship_address1 = prepare_input($_POST['ship_address1']); $ship_address2 = prepare_input($_POST['ship_address2']); $ship_city = prepare_input($_POST['ship_city']);
function inviteEmail() { $toEmails = $_POST['invites']; $emailCount = count($toEmails); $dao = D("User"); $userInfo = $dao->getById(Session::get(C('USER_AUTH_KEY'))); foreach ($toEmails as $k => $toEmail) { $rand = rand(1111, 9999); $toEmail = trim($toEmail); $code = base64_encode($toEmail . "|" . md5($toEmail . $rand)); $map = new HashMap(); $map->put('email', $toEmail); $map->put('active', $rand); $map->put('inviteUser', Session::get(C('USER_AUTH_KEY'))); $dao = D('User'); if ($id = $dao->add($map)) { $code = "http://" . $_SERVER['HOST_NAME'] . __APP__ . "/Public/activate/code/" . $code; $face = str_replace(WEB_PUBLIC_URL . '/Uploads/', "http://" . $_SERVER['HOST_NAME'] . WEB_PUBLIC_URL . '/Uploads/', $userInfo->face); $this->assign('fromuser', $userInfo->name); $this->assign('code', $code); $this->assign('face', $face); $content = $this->fetch('mail'); $title = $userInfo->name . "邀请您体验ThinkSNS!\n"; import('@.Util.sendmail'); if (sendemail($toEmail, $title, $content)) { $success_info .= "<li>{$toEmail} 发送成功!</li>\n"; } else { $success_info .= "<li><font color=red>{$toEmail} 发送失败!</font></li>\n"; } } } $this->assign('count', $emailCount); $this->assign('info', $success_info); $this->display(); }
<?php if (isset($_POST['forgot_password']) && $_POST['forgot_password'] == 'forgot') { $data = NULL; //print_r($_POST); exit; $email_id = $_POST['email_id']; include 'includes/send_mail.php'; include 'includes/classes/class.user.php'; $user = new User(); $data = $user->login_details($email_id); //print_r($data); exit; if (!empty($data['id'])) { sendemail($data['email'], $data['password']); header('Location: http://wmlmusicguide.com/site/admin/viewer_admin/login.php?act=sendmail'); exit; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Admin panel</title> <link rel="stylesheet" href="css/screen.css" type="text/css" media="screen" title="default" /> <!-- jquery core --> <script src="js/jquery/jquery-1.4.1.min.js" type="text/javascript"></script> <!-- Custom jquery scripts --> <script src="js/jquery/custom_jquery.js" type="text/javascript"></script> <!-- MUST BE THE LAST SCRIPT IN <HEAD></HEAD></HEAD> png fix -->
define('SUCCESS_URL', 'gracias.html'); define('NOTSENT_URL', 'emailnoenviado.html'); // the message feedback of ajax request $msg = array('error' => '<p class="error">Por favor corrija los campos marcados en rojo.</p>', 'success' => '<p class="success">Gracias por contactarse con nosotros! Le responderemos a la brevedad.</p>', 'not-sent' => '<p class="error">Ocurrió un error. Por favor intente nuevamente.</p>'); // the field required, by name $required = array('name', 'email', 'message'); /** * Send the email. * * SERVER-SIDE: the functions redirect to some URL, in base of result of control and send. * The urls must be set in the constants above: ERROR_URL, SUCCESS_URL, NOTSENT_URL * * CLIENT-SIDE: in js/contact.js, there is already script for real-time checking of fields * and for ajax request of send email, that request in this page (sendmail.php) and echo the feedback message. */ sendemail(); // NO NEED EDIT function sendemail() { global $msg, $required; if (isset($_POST['ajax'])) { $ajax = $_POST['ajax']; } else { $ajax = false; } if (isset($_POST['action']) and $_POST['action'] == 'sendmail') { $body = BODY; $subject = SUBJECT; $post_data = array_map('stripslashes', $_POST); // print_r($post_data); // die;
$subject = $_POST['subject']; if (!is_email($subject) or $subject == '') { $subject = 'Email without subject.'; } foreach (array_map('stripslashes', $_POST) as $id => $var) { if ($id == 'message') { $var = nl2br($var); } $body = str_replace("%{$id}%", $var, $body); } $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; $headers .= "From: myplace@here.com\r\n"; $sendmail = mail(TO, $subject, $body, $headers); if ($sendmail) { return '<p class="success">Email sent correctly!</p>'; } else { return '<p class="error">An error has been encountered. Please try again.</p>'; } } } function is_email($email) { if (!preg_match("/[a-z0-9][_.a-z0-9-]+@([a-z0-9][0-9a-z-]+.)+([a-z]{2,4})/", $email)) { return false; } else { return true; } } echo sendemail();
$re = stripinput($_GET['re']); if (dbcount("(user_code)", DB_NEW_USERS, "user_code='" . $re . "'")) { $rs_e = dbquery("SELECT * FROM " . DB_NEW_USERS . " WHERE user_code='" . $re . "'"); $rs_ed = dbarray($rs_e); require_once INCLUDES . "sendmail_include.php"; $rs_ed_n = unserialize($rs_ed['user_info']); $sd_1 = $locale['ucc961'] . " " . $rs_ed_n['user_name']; $sd_2 = $locale['ucc961'] . " " . $rs_ed_n['user_name'] . ",\n" . $locale['ucc962a'] . " " . $settings['sitename'] . " " . $locale['ucc962b'] . "\n" . $locale['ucc962c'] . "\n" . $locale['ucc962d'] . " " . $rs_ed_n['user_name'] . "\n" . $locale['ucc962e'] . " " . $rs_ed_n['user_password'] . "\n\n" . $locale['ucc962f'] . "\n"; $activation_url = $settings['siteurl'] . "register.php?activate=" . $rs_ed['user_code']; if (sendemail($rs_ed_n['user_name'], $rs_ed['user_email'], $settings['siteusername'], $settings['siteemail'], $sd_1, $sd_2 . $activation_url)) { opentable($locale['ucc960']); echo "<center>" . $locale['ucc963'] . "</center>"; closetable(); tablebreak(); } else { if (!sendemail($rs_ed_n['user_name'], $rs_ed['user_email'], $settings['siteusername'], $settings['siteemail'], $sd_1, $sd_2 . $activation_url)) { opentable($locale['ucc960']); echo "<center>" . $locale['ucc965'] . "</center>"; closetable(); tablebreak(); } } } else { if (!dbcount("(user_code)", DB_NEW_USERS, "user_code='" . $re . "'")) { opentable($locale['ucc960']); echo "<center>" . $locale['ucc966'] . "</center>"; closetable(); tablebreak(); } } }
} if (strlen($mobile) < 6) { die('xxmn'); } // email must be valid if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { die('xxe'); } // address cannot be blank if (strlen($address) < 7) { die('xxa'); } // send an email to the user $emailContentUser = "******"; // send an email to the admin $emailContentAdmin = "<p>Dear <b>Silverdale High School</b>:</p>\n <p>The website has recieved a {$cboForm} Admission Form Request..</p>\n <p><b>Admission to: </b> {$cboForm}</p>\n <p><b>Name: </b> {$name}</p>\n <p><b>Address: </b> {$address}</p>\n <p><b>Mobile: </b> {$mobile}</p>\n <p><b>Email: </b> {$email}</p>\n <p><b>Comments: </b> {$comments}</p>\n <p>Thanking you.</p>\n <p><b>HMI Tech Support Team.</b></p>"; //echo($emailContent); // redirect to thank you page if (sendemail($email, "{$cboForm} Admission Package", $emailContentUser)) { // done sendemail("*****@*****.**", "New {$cboForm} Admission Package Request", $emailContentAdmin); header("Location: /request-sent.html"); } else { // failed header("Location: /request-failed.html"); } exit; } else { // form is posted from unknown url. die('xx'); }
} catch (Exception $e) { $errorMData = $e->getFile() . ' ' . $e->getLine(); $errorMData .= "\n\n" . $e->getCode() . '' . $e->getMessage(); $errorMData .= "\n\n" . implode("\n", $e->getTrace()); //TODO log error in admin log. Pref for sending email to Administator sendemail($pref['siteadminemail'], $pref['siteadmin'] . ": Cron Schedule Exception", $errorMData, $pref['siteadmin'], $pref['siteadminemail'], $pref['siteadmin']); } // $status = call_user_func(array($obj,$val['function'])); // If task returns value which is not boolean (bc), it'll be used as a message (send email, logs) if ($status && true !== $status) { //TODO log error in admin log. Pref for sending email to Administator // echo "\nerror running the function ".$func.".\n"; // log the error. if ($_E107['debug']) { echo "<br />Method returned message: [{$classname}::" . $val['function'] . '] ' . $status; } sendemail($pref['siteadminemail'], $pref['siteadmin'] . ": Cron Schedule Task Report", "Method returned message: [{$classname}::" . $val['function'] . '] ' . $status, $pref['siteadmin'], $pref['siteadminemail'], $pref['siteadmin']); } } else { if ($_E107['debug']) { echo "<br />Couldn't find method: " . $val['function']; } } } else { if ($_E107['debug']) { echo "<br />Couldn't find class: " . $classname; } } } } // echo "Cron Unix = ". $cron->getLastRanUnix(); // echo "<br />Now = ".time();
function sendemail_template($template_key, $subject, $message, $user, $receiver, $thread_url = "", $toemail, $sender = "", $fromemail = "") { global $settings; $data = dbarray(dbquery("SELECT * FROM " . DB_EMAIL_TEMPLATES . " WHERE template_key='" . $template_key . "' LIMIT 1")); $message_subject = $data['template_subject']; $message_content = $data['template_content']; $template_format = $data['template_format']; $sender_name = $sender != "" ? $sender : $data['template_sender_name']; $sender_email = $fromemail != "" ? $fromemail : $data['template_sender_email']; $subject_search_replace = array("[SUBJECT]" => $subject, "[SITENAME]" => $settings['sitename'], "[SITEURL]" => $settings['siteurl'], "[USER]" => $user, "[SENDER]" => $sender_name, "[RECEIVER]" => $receiver); $message_search_replace = array("[SUBJECT]" => $subject, "[SITENAME]" => $settings['sitename'], "[SITEURL]" => $settings['siteurl'], "[MESSAGE]" => $message, "[USER]" => $user, "[SENDER]" => $sender_name, "[RECEIVER]" => $receiver, "[THREAD_URL]" => $thread_url); foreach ($subject_search_replace as $search => $replace) { $message_subject = str_replace($search, $replace, $message_subject); } foreach ($message_search_replace as $search => $replace) { $message_content = str_replace($search, $replace, $message_content); } if ($template_format == "html") { $message_content = nl2br($message_content); } if (sendemail($receiver, $toemail, $sender_name, $sender_email, $message_subject, $message_content, $template_format)) { return TRUE; } else { return FALSE; } }
function send_pm($to, $from, $subject, $message, $smileys = "y") { global $settings; include LOCALE . LOCALESET . "messages.php"; require_once INCLUDES . "sendmail_include.php"; require_once INCLUDES . "flood_include.php"; $msg_settings = dbarray(dbquery("SELECT pm_inbox, pm_email_notify FROM " . DB_MESSAGES_OPTIONS . " WHERE user_id='0'")); $smileys = preg_match("#(\\[code\\](.*?)\\[/code\\]|\\[geshi=(.*?)\\](.*?)\\[/geshi\\]|\\[php\\](.*?)\\[/php\\])#si", $message) ? "n" : $smileys; $error = 0; if (!flood_control("message_datestamp", DB_MESSAGES, "message_from='" . $from . "'")) { $result = dbquery("SELECT u.user_id, u.user_name, u.user_email, u.user_level, mo.pm_email_notify, COUNT(message_id) as message_count FROM " . DB_USERS . " u\n\t\t\tLEFT JOIN " . DB_MESSAGES_OPTIONS . " mo USING(user_id)\n\t\t\tLEFT JOIN " . DB_MESSAGES . " ON message_to=u.user_id AND message_folder='0'\n\t\t\tWHERE u.user_id='{$to}' GROUP BY u.user_id"); if (dbrows($result)) { $data = dbarray($result); $result = dbquery("SELECT user_id, user_name FROM " . DB_USERS . " WHERE user_id='" . $from . "'"); if (dbrows($result)) { $userdata = dbarray($result); if ($to != $from) { if ($data['user_id'] == 1 || $data['user_level'] > 101 || $msg_settings['pm_inbox'] == "0" || $data['message_count'] + 1 <= $msg_settings['pm_inbox']) { $result = dbquery("INSERT INTO " . DB_MESSAGES . " (message_to, message_from, message_subject, message_message, message_smileys, message_read, message_datestamp, message_folder) VALUES('" . $data['user_id'] . "','" . $userdata['user_id'] . "','" . $subject . "','" . $message . "','" . $smileys . "','0','" . time() . "','0')"); $message_content = str_replace("[SUBJECT]", $subject, $locale['626']); $message_content = str_replace("[USER]", $userdata['user_name'], $message_content); $send_email = isset($data['pm_email_notify']) ? $data['pm_email_notify'] : $msg_settings['pm_email_notify']; if ($send_email == "1") { sendemail($data['user_name'], $data['user_email'], $settings['siteusername'], $settings['siteemail'], $locale['625'], $data['user_name'] . $message_content); } } else { // Inbox is full $error = 1; } } else { // Reciever and sender are the same user $error = 2; } } else { // Sender does not exist in DB $error = 3; } } else { // Reciever does not exist in DB $error = 4; } } else { // Floodcontrol exceeded $error = 5; } return $error; }
include INCLUDES . "user_fields/" . $data['field_name'] . "_include.php"; } } } } if ($error == "") { if ($settings['email_verification'] == "1") { require_once INCLUDES . "sendmail_include.php"; mt_srand((double) microtime() * 1000000); $salt = ""; for ($i = 0; $i <= 7; $i++) { $salt .= chr(rand(97, 122)); } $user_code = md5($email . $salt); $activation_url = $settings['siteurl'] . "register.php?activate=" . $user_code; if (sendemail($username, $email, $settings['siteusername'], $settings['siteemail'], $locale['449'], $locale['450'] . $activation_url)) { $user_info = serialize(array("user_name" => $username, "user_password" => encrypt_pw($password1), "user_email" => $email, "user_hide_email" => isnum($_POST['user_hide_email']) ? $_POST['user_hide_email'] : "1")); $result = dbquery("INSERT INTO " . DB_NEW_USERS . " (user_code, user_email, user_datestamp, user_info) VALUES('{$user_code}', '" . $email . "', '" . time() . "', '{$user_info}')"); // Log Registration + Security Question log_registration($username, $email, $log); opentable($locale['400']); echo "<div style='text-align:center'><br />\n" . $locale['454'] . "<br /><br />\n</div>\n"; closetable(); } else { opentable($locale['456']); echo "<div style='text-align:center'><br />\n" . $locale['457'] . "<br /><br />\n</div>\n"; closetable(); } } else { $user_status = $settings['admin_activation'] == "1" ? "2" : "0"; $result = dbquery("INSERT INTO " . DB_USERS . " (user_name, user_password, user_admin_password, user_email, user_hide_email, user_avatar, user_posts, user_threads, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status" . $db_fields . ") VALUES('{$username}', '" . encrypt_pw($password1) . "', '', '" . $email . "', '{$user_hide_email}', '', '0', '0', '" . time() . "', '0', '" . USER_IP . "', '', '', '" . nMEMBER . "', '{$user_status}'" . $db_values . ")");
include LOCALE . LOCALESET . "reactivate.php"; if (iMEMBER) { redirect("index.php"); } if (isset($_GET['user_id']) && isnum($_GET['user_id']) && isset($_GET['code']) && preg_check("/^[0-9a-z]{32}\$/", $_GET['code'])) { $result = dbquery("SELECT user_name, user_email, user_actiontime, user_password FROM " . DB_USERS . " WHERE user_id='" . $_GET['user_id'] . "' AND user_actiontime>'0' AND user_status='7'"); if (dbrows($result)) { $data = dbarray($result); $code = md5($data['user_actiontime'] . $data['user_password']); if ($_GET['code'] == $code) { if ($data['user_actiontime'] > time()) { $result = dbquery("UPDATE " . DB_USERS . " SET user_status='0', user_actiontime='0', user_lastvisit='" . time() . "' WHERE user_id='" . $_GET['user_id'] . "'"); unsuspend_log($_GET['user_id'], 7, $locale['506'], true); $message = str_replace("[USER_NAME]", $data['user_name'], $locale['505']); require_once INCLUDES . "sendmail_include.php"; sendemail($data['user_name'], $data['user_email'], $settings['siteusername'], $settings['siteemail'], $locale['504'], $message); redirect(BASEDIR . "login.php"); } else { redirect(FUSION_SELF . "?error=1"); } } else { redirect(FUSION_SELF . "?error=2&user_id=" . $data['user_id'] . "&code=" . $_GET['code']); } } else { redirect(FUSION_SELF . "?error=3"); } } elseif (isset($_GET['error']) && isnum($_GET['error'])) { opentable($locale['500']); if ($_GET['error'] == 1) { echo $locale['501']; } elseif ($_GET['error'] == 2) {