function cron_signtz_mail() { global $m; $today = date("Y-m-d"); $lastday = option::get('haotian_mail'); if ((time() - 1396281600) % 86400 < 21600) { return '未到发送邮件时间'; } if ($today != $lastday) { option::set('haotian_mail', $today); } else { return '今日任务已经执行完毕'; } $query = $m->query("SELECT * FROM `" . DB_NAME . "`.`" . DB_PREFIX . "users`"); while ($fetch = $m->fetch_array($query)) { $mail = $fetch['email']; $name = $fetch['name']; $id = $fetch['id']; if (option::uget('haotian_mail_enable', $id) == 1) { $title = "[" . date("Y-m-d") . "] " . SYSTEM_NAME . " - {$name} - 签到报告"; $query2 = $m->query("SELECT * FROM `" . DB_NAME . "`.`" . DB_PREFIX . "tieba` WHERE `uid`={$id}"); $c = 0; $content = '<p class="sign_title">' . SYSTEM_NAME . ' - 签到报告</p><p>' . date("Y-m-d") . '<br>站点地址:<a href="' . SYSTEM_URL . '">' . SYSTEM_URL . '</a>' . '<br>若有大量贴吧签到失败,建议您重新设置 Cookie 相关信息</p><table class="result_table"><thead><tr><td style="width: 40px">#</td><td>贴吧</td><td style="width: 75px">状态</td><td style="width: 75px">经验</td></tr></thead><tbody>'; while ($ff = $m->fetch_array($query2)) { $c++; $tie8 = $ff['tieba']; $status = $ff['status']; $content .= "<tr><td>{$c}</td><td><a href=" . '"http://tieba.baidu.com/f?kw=' . urlencode($tie8) . '" target="_blank">' . $tie8 . '</a>' . "</td>"; if ($status == 0) { $content .= "<td>已签到</td><td>+8</td>"; } else { $content .= "<td>签到失败</td><td>-</td>"; } $content .= "</tr>"; } $content .= "</tbody></table>"; $content = '<style type="text/css">div.wrapper * { font: 12px "Microsoft YaHei", arial, helvetica, sans-serif; word-break: break-all; }div.wrapper a { color: #15c; text-decoration: none; }div.wrapper a:active { color: #d14836; }div.wrapper a:hover { text-decoration: underline; }div.wrapper p { line-height: 20px; margin: 0 0 .5em; text-align: center; }div.wrapper .sign_title { font-size: 20px; line-height: 24px; }div.wrapper .result_table { width: 85%; margin: 0 auto; border-spacing: 0; border-collapse: collapse; }div.wrapper .result_table td { padding: 10px 5px; text-align: center; border: 1px solid #dedede; }div.wrapper .result_table tr { background: #d5d5d5; }div.wrapper .result_table tbody tr { background: #efefef; }div.wrapper .result_table tbody tr:nth-child(odd) { background: #fafafa; }</style><div class="wrapper">' . $content . '</div><br><p style="font-size: 12px; color: #9f9f9f; text-align: right; border-top: 1px solid #dedede; padding: 20px 10px 0; margin-top: 25px;">此封邮件来自 百度贴吧云签到<br>Haotian Mail API v0.1, 2014 © <a href="http://ihaotian.me/">Haotian\'s Laboratory</a>.</p>'; if ($c == 0) { continue; } $x = misc::mail($mail, $title, $content); if ($x != true) { return '发送失败,错误日志:' . $x; } } } return '邮件发送成功!'; }
/** * 变量名称 * @param $verifyKey 发送邮件中的key,用于验证用户身份是否与$verifyCode匹配 * @param $query SQL查询语句 * @param $url 验证链接地址 * @param $verifyCode 验证码 * @param $pluginName 插件名 */ function sendMail($userMail, $uid) { global $m; global $today; $pluginName = 'white_vmail'; // 获取8位数的随机验证码并加密 $verifyCode = rand_int(8); $verifyKey = sha1(md5($verifyCode)); $url = SYSTEM_URL . '?plugin=' . $pluginName . '&key=' . $verifyKey; $title = '邮箱验证 -- ' . SYSTEM_NAME; $text = '亲爱的用户:<br><br>您好!<br><br>这是来自学园百度贴吧云签到平台的验证邮件,用来验证您的用户邮箱。<br><br>请登录学园百度贴吧云签到平台后点击该链接,以便验证你的邮箱。<br><br>提示:必须登录后点击!必须登录后点击!必须登录后点击! 否则无法验证!谢谢合作!<br><br>系统将会自动清除注册一定时间后没验证邮箱的用户!<hr/>验证链接:' . $url . '<br>(如果您无法点击此链接,请将它复制到浏览器地址栏后访问)<br><br><br>' . SYSTEM_NAME . '<br><br>(本邮件为系统自动发送,请勿回复)'; $mailResult = misc::mail($userMail, $title, $text); if ($mailResult != TRUE) { msg("向" . $userMail . "发送邮件失败。"); } $m->query("UPDATE " . DB_PREFIX . "users SET white_vmail_send = 1, white_vmail_code = " . $verifyCode . " WHERE id = " . $uid); Redirect(SYSTEM_URL . "index.php?mod=admin:setplug&plug=white_vmail"); }
function cron_wmzz_mailer() { global $m; $check = option::get('wmzz_mailer_check'); if ($check == '1') { $text = option::get('wmzz_mailer_text'); $title = option::get('wmzz_mailer_title'); $limit = option::get('wmzz_mailer_limit'); $last = option::get('wmzz_mailer_last'); $done = 0; $z = $m->query("SELECT * FROM `" . DB_NAME . "`.`" . DB_PREFIX . "users` LIMIT {$last},{$limit}"); while ($v = $m->fetch_array($z)) { $done++; misc::mail($v['email'], $title, $text); } if ($done - $limit <= -1) { option::set('wmzz_mailer_check', '0'); option::set('wmzz_mailer_last', '0'); cron::set('wmzz_mailer', 'plugins/wmzz_mailer/wmzz_mailer_cron.php', 1); return '所有邮件群发任务于 ' . date('Y-m-d H:m:s') . ' 完成'; } option::set('wmzz_mailer_last', $done + $last); } }
$dump .= 'MySQL Server Version : ' . $m->getMysqlVersion() . PHP_EOL; $dump .= 'Date: ' . date('Y-m-d H:i:s') . PHP_EOL; $dump .= '*/' . PHP_EOL . PHP_EOL; $dump .= '-------------- Start --------------' . PHP_EOL . PHP_EOL; $dump .= 'SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";' . PHP_EOL; $dump .= 'SET FOREIGN_KEY_CHECKS=0;' . PHP_EOL; $dump .= 'SET time_zone = "+8:00";' . PHP_EOL . PHP_EOL; while ($v = $m->fetch_array($e)) { $list = $v; foreach ($list as $table) { $dump .= dataBak($table); } } $dump .= PHP_EOL . '-------------- End --------------'; $title = SYSTEM_NAME . " " . date('Y-m-d') . " 数据库备份"; $x = misc::mail($email, $title, "备份文件已附上,请查看附件", array('backup-' . date('Ymd') . '.sql' => $dump)); if ($x != true) { option::set('dl_backup_log', date('Y-m-d H:i:s') . ' 数据库备份邮件发送失败!'); ReDirect(SYSTEM_URL . 'index.php?mod=admin:setplug&plug=dl_backup&wrong'); } else { option::set('dl_backup_log', date('Y-m-d H:i:s') . ' 数据库备份邮件发送成功!'); ReDirect(SYSTEM_URL . 'index.php?mod=admin:setplug&plug=dl_backup&success'); } } } ?> <h3>自动数据库备份设置</h3><br/> <form action="index.php?mod=admin:setplug&plug=dl_backup&set" method="post"> <div class="input-group"> <span class="input-group-addon">接收备份邮箱</span> <input type="email" name="email" class="form-control" value="<?php
?> <?php global $m; if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'yz') { $mail = !empty($_POST['mail']) ? checkMail($_POST['mail']) ? $_POST['mail'] : ReDirect('index.php?pub_plugin=dl_zhmm&error_msg=' . urlencode('邮箱地址不合法,请重新输入')) : ReDirect('index.php?pub_plugin=dl_zhmm&error_msg=' . urlencode('邮箱地址为空,请重新输入')); $cx = $m->query("SELECT * FROM `" . DB_NAME . "`.`" . DB_PREFIX . "users` WHERE email = '{$mail}' LIMIT 1"); $p = $m->fetch_array($cx); if ($p == "") { ReDirect(SYSTEM_URL . 'index.php?pub_plugin=dl_zhmm&error_msg=' . urlencode('错误:未能在本站找到持有该邮箱的用户!')); die; } $pw = sha1(md5(EncodePwd($p['pw'] . date('Ymd') . SYSTEM_NAME . SYSTEM_VER . SYSTEM_URL))); $title = strip_tags(SYSTEM_NAME) . " - 找回密码"; $text = "请点击以下链接重置密码:" . SYSTEM_URL . "index.php?pub_plugin=dl_zhmm" . '&page=yjqr' . '&email=' . base64_encode($mail) . '&key=' . $pw; $x = misc::mail($mail, $title, $text); if ($x != true) { ReDirect(SYSTEM_URL . 'index.php?pub_plugin=dl_zhmm&error_msg=' . urlencode('错误:找回密码邮件发送失败,请检查邮件相关设置!')); } else { ReDirect(SYSTEM_URL . 'index.php?pub_plugin=dl_zhmm&success_msg=' . urlencode('成功:邮件发送成功,请登录邮箱按照提示操作!')); } } if (isset($_GET['xg'])) { global $m; $emailcc = !empty($_REQUEST['email']) ? base64_decode($_REQUEST['email']) : msg('警告:邮件地址无效'); $email = checkMail($emailcc) ? sqladds($emailcc) : msg('警告:非法操作'); $key = $_REQUEST['key']; $newpw = EncodePwd($_POST['pw']); $cx = $m->query("SELECT * FROM `" . DB_NAME . "`.`" . DB_PREFIX . "users` WHERE email = '{$email}' LIMIT 1"); $p = $m->fetch_array($cx); if ($p == "") {
function reg_supervise_yx() { global $m; $name = isset($_POST['user']) ? addslashes(strip_tags($_POST['user'])) : ''; $mail = isset($_POST['mail']) ? addslashes($_POST['mail']) : ''; $pw = isset($_POST['pw']) ? addslashes(strip_tags($_POST['pw'])) : ''; $role = 'banned'; $m->query('INSERT INTO `' . DB_NAME . '`.`' . DB_PREFIX . 'users` (`id`, `name`, `pw`, `email`, `role`, `t`) VALUES (NULL, \'' . $name . '\', \'' . EncodePwd($pw) . '\', \'' . $mail . '\', \'' . $role . '\', \'' . getfreetable() . '\');'); $ip = $_SERVER['REMOTE_ADDR']; setcookie("reg_check", date('d'), time() + 86400); $m->query('INSERT INTO `' . DB_NAME . '`.`' . DB_PREFIX . 'reg` (`ip`) VALUES (\'' . $ip . '\');'); $key = sha1(md5(EncodePwd($pw) . date('Ymd') . option::get(salt))); $title = strip_tags(SYSTEM_NAME) . " - 注册验证"; $text = "你在" . SYSTEM_URL . " 使用IP:" . $ip . " 用此邮箱注册了账号,账号:" . $name . ",密码" . $pw . "<br>点击以下链接完成安全验证,即可正常使用本站服务。如果显示禁止访问,使用浏览器隐身模式再打开链接即可<br><p>本邮件为系统自动发送,请勿回复。如果你没有进行此操作,可能是有人冒用了此邮箱,请不要点击链接</p><br>验证链接(当日有效):" . SYSTEM_URL . "index.php?pub_plugin=reg_supervise" . '&jh' . '&email=' . base64_encode($mail) . '&key=' . $key; $x = misc::mail($mail, $title, $text); if ($x != true) { $m->query("UPDATE `" . DB_NAME . "`.`" . DB_PREFIX . "users` SET `role` = 'user' WHERE email = '{$mail}'"); $js = option::get('reg_jg'); option::set('reg_jg', $js + 1); ReDirect(SYSTEM_URL . 'index.php?pub_plugin=reg_supervise&error_msg=验证邮件发送失败!已为你激活用户!请登录。'); die; } else { option::set('reg_jg', 0); ReDirect(SYSTEM_URL . 'index.php?pub_plugin=reg_supervise&success_msg=请登录你的邮箱点击确认链接!否则无法登陆本站!'); } die; }
msg('邮箱格式有误,请检查'); } } $set = array(); foreach ($PostArray as $value) { if (!isset($i['post'][$value])) { $i['post'][$value] = ''; } @option::uset($value, $i['post'][$value]); } doAction('set_save2'); Redirect('index.php?mod=set&ok'); break; case 'admin:testmail': global $i; $x = misc::mail($i['user']['email'], SYSTEM_FN . ' V' . SYSTEM_VER . ' - 邮件发送测试', '这是一封关于 ' . SYSTEM_FN . ' 的测试邮件,如果你收到了此邮件,表示邮件系统可以正常工作<br/><br/>站点地址:' . SYSTEM_URL, array('测试附件.txt' => '这是一个测试附件')); if ($x === true) { Redirect('index.php?mod=admin:set&mailtestok'); } else { msg('邮件发送失败,发件日志:<br/>' . $x); } break; case 'admin:testbbs': global $i; $ch_url = SUPPORT_URL . 'getplug.php?m=check&user='******'bbs_us') . '&pw=' . option::get('bbs_pw'); $c = new wcurl($ch_url); $x = $c->exec(); $c->close(); if ($x == 'RIGHT') { Redirect('index.php?mod=admin:set&bbstestok'); } else {
break; } if ($m->query('Delete From ' . DB_PREFIX . 'users Where id=' . $_GET["uid"])) { if (SYSTEM_VER >= 3.4) { $m->query('Delete From ' . DB_PREFIX . 'users_options Where uid=' . $_GET["uid"]); } $ary["status"] = "true"; } else { $ary["status"] = "false"; $ary["msg"] = "数据库错误,删除失败"; } echo json_encode($ary); } break; case 'mail': if (isset($_GET["id"])) { $ret = $m->once_fetch_array('Select email From ' . DB_PREFIX . 'users Where id=' . $_GET["id"]); if (isset($ret['email']) && $ret['email'] != '') { $x = misc::mail($ret['email'], '你在云签中绑定的百度帐号过期了 - 来自BDUSS有效性检测插件', '你在' . SYSTEM_URL . '云签中绑定的百度帐号过期了,这将导致无法继续签到,请登录并重新绑定'); if ($x === true) { echo json_encode(array('status' => 'true')); } else { echo json_encode(array('status' => 'false', 'msg' => '邮件发送失败,请检查邮件综合设置 ')); } } else { echo json_encode(array('status' => 'false', 'msg' => '没有找到该用户的E-mail')); } } break; } }
<?php if (!defined('SYSTEM_ROOT')) { die('Insufficient Permissions'); } $last = option::get('dl_yjtz_last'); if ($last != date('Y-m-d')) { global $m; $max = $m->fetch_array($m->query("select max(id) as id from `" . DB_NAME . "`.`" . DB_PREFIX . "users`")); $max = $max['id']; $lastdo = option::get('dl_yjtz_time'); for ($ii = $lastdo; $ii <= $max; $ii++) { $user = $m->fetch_array($m->query('select * from `' . DB_NAME . '`.`' . DB_PREFIX . 'users` where `id` = ' . $ii)); if (!empty($user['email'])) { $op = $m->fetch_array($m->query('select * from `' . DB_NAME . '`.`' . DB_PREFIX . 'users_options` where `uid` = ' . $user['id'] . ' and `name` = "dl_yjtz_enable"')); if ($op['value'] == 1) { $url = SYSTEM_URL . 'index.php?pub_plugin=dl_yjtz&username='******'name'] . '&token=' . md5(md5(md5(md5($user['name'] . $user['pw'] . date('Y-m-d'))))); $x = misc::mail($user['email'], SYSTEM_NAME . '-签到通知', '您可通过此链接查看您的当日签到情况(次日自动失效):<a href="' . $url . '">' . $url . '</a>'); option::set('dl_yjtz_time', $ii); } } } if (option::get('dl_yjtz_time') >= $max) { option::set('dl_yjtz_time', 0); } option::set('dl_yjtz_last', date('Y-m-d')); }
break; } if ($m->query('Delete From ' . DB_PREFIX . 'users Where id=' . $_GET["uid"])) { if (SYSTEM_VER >= 3.4) { $m->query('Delete From ' . DB_PREFIX . 'users_options Where uid=' . $_GET["uid"]); } $ary["status"] = "true"; } else { $ary["status"] = "false"; $ary["msg"] = "数据库错误,删除失败"; } echo json_encode($ary); } break; case 'mail': if (isset($_GET["id"])) { $ret = $m->once_fetch_array('Select email From ' . DB_PREFIX . 'users Where id=' . $_GET["id"]); if (isset($ret['email']) && $ret['email'] != '') { $x = misc::mail($ret['email'], '绑定帐号过期通知 - ' . strip_tags(SYSTEM_NAME), '<br>您好:<p>您在 ' . SYSTEM_URL . ' ' . SYSTEM_NAME . ' 中绑定的百度帐号过期了,这将导致无法继续签到,请登录并重新绑定!</p><p>温馨提示:建议一个月更新一次绑定信息,以便保证稳定签到!</p><br /><p>' . SYSTEM_NAME . '</p><p>' . date("Y-n-j H:i:s") . '</p>'); if ($x === true) { echo json_encode(array('status' => 'true')); } else { echo json_encode(array('status' => 'false', 'msg' => '邮件发送失败,请检查邮件综合设置 ')); } } else { echo json_encode(array('status' => 'false', 'msg' => '没有找到该用户的E-mail')); } } break; } }