public function findemailcheck() { $title = "通过邮箱找回密码"; $enname = $this->segment(4); $name = _encrypt($this->segment(4), "DECODE"); $info = $this->DB()->GetOne("SELECT * FROM `@#_member` WHERE `email` = '{$name}' LIMIT 1"); if (!$info) { _message("未知错误!"); } $emailurl = explode("@", $info['email']); if ($info['passcode'] == -1) { $passcode = _getcode(10); $passcode = $passcode['code'] . '|' . $passcode['time']; //验证码 $urlcheckcode = _encrypt($info['email'] . "|" . $passcode); $url = WEB_PATH . '/member/finduser/findok/' . $urlcheckcode; $this->DB()->Query("UPDATE `@#_member` SET `passcode`='{$passcode}' where `uid`='{$info['uid']}'"); $tit = _cfg("web_name") . "邮箱找回密码"; $content = '<span>请在24小时内激活邮件</span>,点击连接激活邮件:<a href="' . WEB_PATH . '/member/finduser/findok/' . $urlcheckcode . '">'; $content .= $url; $content .= '</a>'; _sendemail($info['email'], '', $tit, $content); } include templates("user", "findemailcheck"); }
/** * 发送用户获奖邮箱 * email @用户邮箱地址 * uid @用户的ID * usernname @用户名称 * code @中奖号码 * shoptitle @商品名称 */ function send_email_code($email = null, $username = null, $uid = null, $code = null, $shoptitle = null) { $db = System::load_sys_class('model'); $template = $db->GetOne("select * from `@#_caches` where `key` = 'template_email_shop'"); if (!$template) { $template = array(); $template['value'] = "恭喜您:{$username},你在" . _cfg("web_name") . "够买的商品{$shoptitle}已中奖,中奖码是:" . $code; } else { $template['value'] = str_ireplace("{用户名}", $username, $template['value']); $template['value'] = str_ireplace("{商品名称}", $shoptitle, $template['value']); $template['value'] = str_ireplace("{中奖码}", $code, $template['value']); } $title = "恭喜您!!! 您在" . _cfg("web_name") . "够买的商品中奖了!!!"; return _sendemail($email, '', $title, $template['value']); }
public function email() { $cesi = $this->segment(4); if ($cesi == 'cesi') { $youxiang = $this->segment(5); $youxiang = str_replace("|", ".", $youxiang); $ok = _sendemail($youxiang, '', "后台邮箱配置测试成功", "<b>恭喜你邮箱测试成功</b>", "1", "0"); if ($ok == '1') { echo "邮件测试成功"; } else { echo "邮件测试失败"; } exit; } if (isset($_POST['dosubmit'])) { $stmp_host = htmlspecialchars($_POST['server']); $email = htmlspecialchars($_POST['email']); $user = htmlspecialchars($_POST['user']); $pass = htmlspecialchars($_POST['pass']); $big = htmlspecialchars($_POST['big']); $fromName = htmlspecialchars($_POST['name']); $html = <<<HTML \t\t\t<?php \t\t\treturn array (\t \t\t\t\t'stmp_host' => '{$stmp_host}',\t//stmp服务器 \t\t\t\t'user' => '{$user}',//账号 \t\t\t\t'pass' => '{$pass}',\t\t//密码 \t\t\t\t'big' => '{$big}',\t\t\t\t//发送编码 \t\t\t\t'from' => "{$email}",//发件人 \t\t\t\t'fromName' => "{$fromName}", \t\t//发件人名 \t\t\t\t'nohtml' => "不支持HTML格式" \t//不支持HTML \t\t\t); \t\t\t?> HTML; if (!is_writable(G_CONFIG . 'email.inc.php')) { _message('Please chmod email to 0777 !'); } $ok = file_put_contents(G_CONFIG . 'email.inc.php', $html); if ($ok) { _message("操作成功"); } } $info = System::load_sys_config("email"); include $this->tpl(ROUTE_M, 'config.email'); }
public function sendsuccess() { if (!isset($_POST['submit'])) { _message("参数错误", WEB_PATH . '/member/home/modify'); } if (!isset($_POST['email']) || empty($_POST['email'])) { _message("邮箱地址不能为空!", WEB_PATH . '/member/home/modify'); } if (!_checkemail($_POST['email'])) { _message("邮箱格式错误!", WEB_PATH . '/member/home/modify'); } $config_email = System::load_sys_config("email"); if (empty($config_email['user']) && empty($config_email['pass'])) { _message("系统邮箱配置不正确!", WEB_PATH . '/member/home/modify'); } $member = $this->userinfo; $title = "发送成功"; $email = $_POST['email']; $member2 = $this->db->GetOne("select * from `@#_member` where `email`='{$email}' and `uid` != '{$member['uid']}'"); if (!empty($member2) && $member2['emailcode'] == 1) { _message("该邮箱已经存在,请选择另外的邮箱验证!", WEB_PATH . '/member/home/modify'); } $strcode1 = $email . "," . $member['uid'] . "," . time(); $strcode = _encrypt($strcode1); $tit = $this->_cfg['web_name_two'] . "激活注册邮箱"; $content = '<span>请在24小时内绑定邮箱</span>,点击链接:<a href="' . WEB_PATH . '/member/home/emailcheckingok/' . $strcode . '">'; $content .= WEB_PATH . '/member/home/emailcheckingok/' . $strcode . '</a>'; $succ = _sendemail($email, '', $tit, $content, 'yes', 'no'); if ($succ == 'no') { _message("邮件发送失败!", WEB_PATH . '/member/home/modify', 30); } else { include templates("member", "sendsuccess"); } }
function siteadmin($site, $action = '', $count = 0, $sort = '', $ord = '') { if (empty($site)) { exit('This controller is only for subdomains.'); } // This controller is only for subdomains. $this->load->model('Owner_model'); $_ddata['site'] = $site; $this->load->view('admin6_owner_top', $_ddata); $_tdata = $this->Site_model->getWhere(array('subdomain' => $site), 1); $this->subdomainId = $_tdata[0]['id']; if ($sort == '') { $dsort = 'id DESC'; $sort = 'id'; } else { if ($ord == '') { $ord = 'ASC'; } $dsort = $sort . ' ' . $ord; } if ($action == '') { $action = 'appQueue'; } if ($action == 'appQueue') { if ($this->input->post('action')) { $_ddata = $this->Owner_model->getAppUsers($count, $dsort, $this->subdomainId); foreach ($_ddata as $imember) { if ($this->input->post('radio' . $imember['user_id']) == 'approve') { //---approve member $uid = array('site_id' => $this->subdomainId, 'user_id' => $imember['user_id']); $_data1 = array('member_y_n' => 1); $this->User_is_member_of_site_model->update_array($uid, $_data1); $_data['changelist'][] = 'User ' . $imember['username'] . ' (#' . $imember['user_id'] . ') approved!'; //---send approval email $userdata = $this->User_model->getById($imember['user_id']); $sitedata = $this->Site_model->getById($this->subdomainId); _sendemail('approval', array('username' => $userdata['username'], 'sitename' => $sitedata['sitename'], 'subdomain' => $sitedata['subdomain'], 'email' => $userdata['email'])); } elseif ($this->input->post('radio' . $imember['user_id']) == 'deny') { //---deny member $uid = array('site_id' => $this->subdomainId, 'user_id' => $imember['user_id']); $_data1 = array('member_y_n' => 0); $this->User_is_member_of_site_model->update_array($uid, $_data1); $_data['changelist'][] = 'User ' . $imember['username'] . ' (#' . $imember['user_id'] . ') denied!'; //---send denied email $userdata = $this->User_model->getById($imember['user_id']); $sitedata = $this->Site_model->getById($this->subdomainId); _sendemail('denial', array('username' => $userdata['username'], 'sitename' => $sitedata['name'], 'email' => $userdata['email'])); } } } //---show page $this->load->library('pagination'); $config['base_url'] = 'http://' . $_SERVER['HTTP_HOST'] . '/admin6/siteadmin/appQueue/'; $config['total_rows'] = $this->User_is_member_of_site_model->getListCount(array('site_id' => $this->subdomainId, 'member_y_n' => NULL)); $config['per_page'] = '20'; $this->pagination->initialize($config); $_data['query'] = $this->Owner_model->getAppUsers($count, $dsort, $this->subdomainId); $_data['count'] = $count; $_data['site'] = $site; $_data['csort'] = $sort; $_data['cord'] = $ord; $this->load->view('admin6_owner_app_queue', $_data); } elseif ($action == 'moderatePosts') { if ($this->input->post('action')) { $data['message'] = $this->input->post('message'); $this->Owner_model->updatePost($this->input->post('id'), $data); } //---load posts and display page $where = 'site_id = ' . $this->subdomainId; $data = $this->Post_model->getPosts(100, $count, $where, $dsort); $adata['query'] = $data; $adata['count'] = $count; $this->load->library('pagination'); $this->load->helper('url'); $config['base_url'] = 'http://' . $_SERVER['HTTP_HOST'] . '/admin6/siteadmin/moderatePosts/'; $config['total_rows'] = $this->Owner_model->getListCount(array('site_id' => $this->subdomainId)); $config['per_page'] = '100'; $this->pagination->initialize($config); $adata['site'] = $site; $adata['csort'] = $sort; $adata['cord'] = $ord; $this->load->view('admin6_owner_moderate_posts', $adata); } elseif ($action == 'editPost') { $id = $count; $data = $this->Owner_model->getPost($id); $adata['query'] = $data; $adata['id'] = $id; $adata['site'] = $site; $this->load->helper('url'); $this->load->view('admin6_owner_post_edit', $adata); } elseif ($action == 'deletePost') { $id = $count; $type = $sort; if ($type == 'message') { $this->Owner_model->deletepost($id); } elseif ($type == 'video') { $this->Post_videos_model->delete($id); } elseif ($type == 'picture') { $this->Post_pictures_model->delete($id); } $adata['site'] = $site; $this->load->view('admin6_owner_post_delete', $adata); } elseif ($action == 'members') { if ($this->input->post('action')) { $_ddata = $this->Owner_model->getUsers($count, $dsort, $this->subdomainId); foreach ($_ddata as $imember) { if ($this->input->post('rem' . $imember['user_id']) == 'remove') { //remove member $uid = array('site_id' => $this->subdomainId, 'user_id' => $imember['user_id']); $this->User_is_member_of_site_model->delete($uid); $_data['changelist'][] = 'User ' . $imember['username'] . ' (#' . $imember['user_id'] . ') removed!'; } } } $this->load->library('pagination'); $config['base_url'] = 'http://' . $_SERVER['HTTP_HOST'] . '/admin6/siteadmin/members/'; $config['total_rows'] = $this->User_is_member_of_site_model->getListCount(array('site_id' => $this->subdomainId, 'member_y_n' => NULL)); $config['per_page'] = '20'; $this->pagination->initialize($config); $_data['query'] = $this->Owner_model->getUsers($count, $dsort, $this->subdomainId); $_data['count'] = $count; $_data['site'] = $site; $_data['csort'] = $sort; $_data['cord'] = $ord; $this->load->view('admin6_owner_members', $_data); } }