public function submit() { $ip_false = M('option')->where("meta_key='ip_false' AND type='user'")->getField('meta_value', true); if ($ip_false && in_array(mc_user_ip(), $ip_false)) { $this->error('您的IP被永久禁止登陆!'); } else { $user_name = mc_magic_in(mc_remove_html($_POST['user_name'], 'all')); if ($user_name == '') { $this->error('账号必须填写!'); } else { $user_login = M('meta')->where("meta_key='user_name' AND type ='user'")->getField('meta_value', true); if (in_array(strip_tags($_POST['user_name']), $user_login)) { $this->error('账号已存在!'); } } $user_email = mc_magic_in(mc_remove_html($_POST['user_email'], 'all')); if (empty($user_email)) { $this->error('邮箱必须填写!'); } else { $user_email = M('meta')->where("meta_key='user_email' AND type ='user'")->getField('meta_value', true); if (in_array(strip_tags($_POST['user_email']), $user_email)) { $this->error('邮箱已存在!'); } } if (empty($_POST['user_pass'])) { $this->error('密码必须填写!'); } if ($_POST['user_pass'] != $_POST['user_pass2']) { $this->error('两次密码必须一致!'); } $user['title'] = I('param.user_name'); $user['content'] = ''; $user['type'] = 'user'; $user['date'] = strtotime("now"); $result = M("page")->data($user)->add(); if ($result) { mc_add_meta($result, 'user_name', $user_name, 'user'); $user_pass = md5(I('param.user_pass') . mc_option('site_key')); mc_add_meta($result, 'user_pass', $user_pass, 'user'); mc_add_meta($result, 'user_email', $user_email, 'user'); mc_add_meta($result, 'user_level', '1', 'user'); cookie('user_name', I('param.user_name'), 36000000000); cookie('user_pass', $user_pass, 36000000000); $ip_array = M('action')->where("page_id='" . mc_user_id() . "' AND action_key='ip'")->getField('action_value', true); if ($ip_array && in_array(mc_user_ip(), $ip_array)) { } else { if (!mc_is_admin()) { mc_add_action(mc_user_id(), 'ip', mc_user_ip()); } } if ($_POST['comefrom']) { $this->success('注册成功', $_POST['comefrom']); } else { $this->success('注册成功', U('user/index/edit?id=' . mc_user_id())); } } else { $this->error('注册失败'); } } }
public function submit() { $ip_false = M('option')->where("meta_key='ip_false' AND type='user'")->getField('meta_value', true); if ($ip_false && in_array(mc_user_ip(), $ip_false)) { $this->error('您的IP被永久禁止登陆!'); } else { $page_id = M('meta')->where("meta_key='user_name' AND meta_value='" . mc_magic_in(I('param.user_name')) . "' AND type='user'")->getField('page_id'); $user_pass_true = mc_get_meta($page_id, 'user_pass', true, 'user'); if ($_POST['user_name'] && $_POST['user_pass'] && md5($_POST['user_pass'] . mc_option('site_key')) == $user_pass_true) { $user_pass = md5(I('param.user_pass') . mc_option('site_key')); cookie('user_name', I('param.user_name'), 36000000000); cookie('user_pass', $user_pass, 36000000000); $ip_array = M('action')->where("page_id='" . mc_user_id() . "' AND action_key='ip'")->getField('action_value', true); if ($ip_array && in_array(mc_user_ip(), $ip_array)) { } else { if (!mc_is_admin()) { mc_add_action(mc_user_id(), 'ip', mc_user_ip()); } } if ($_POST['comefrom']) { $this->success('登陆成功', $_POST['comefrom']); } else { if (mc_is_mobile()) { $this->success('登陆成功', U('user/index/pro?id=' . mc_user_id())); } else { $this->success('登陆成功', U('user/index/index?id=' . mc_user_id())); } } } else { $this->error('用户名与密码不符!'); } } }
public function add_article() { if (mc_is_admin() || mc_is_bianji()) { $this->theme(mc_option('theme'))->display('Publish/add_article'); } else { $this->success('请先登陆', U('User/login/index')); } }
public function publish($id) { if (is_numeric($id)) { if (mc_is_admin()) { mc_update_page($id, 'publish', 'type'); $this->success('审核成功!'); } else { $this->error('您没有权限访问此页面!'); } } else { $this->error('参数错误!'); } }
public function pending($page = 1) { if (mc_is_admin() || mc_is_bianji()) { $this->page = M('page')->where('type="pending"')->order('id desc')->page($page, mc_option('page_size'))->select(); $count = M('page')->where('type="pending"')->count(); $this->assign('id', $id); $this->assign('count', $count); $this->assign('page_now', $page); $this->theme(mc_option('theme'))->display('Post/pending'); } else { $this->error('你没有权限查看此页面!'); } }
"> 删除 </a> </div> </div> </div> <?php } ?> </div> <?php echo mc_pagenavi($count, $page_now, 30); ?> </div> <?php if (mc_is_admin()) { ?> <!-- Modal --> <div class="modal fade" id="addtermModal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> </div> <form role="form" method="post" action="<?php echo U('home/perform/publish_term'); ?> "> <div class="modal-body"> <div class="form-group"> <label>
"> 删除 </a> </div> </div> </div> <?php } ?> </div> <?php echo mc_pagenavi($count, $page_now, 30); ?> </div> <?php if (mc_is_admin() || mc_is_bianji()) { ?> <!-- Modal --> <div class="modal fade" id="addtermModal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> </div> <form role="form" method="post" action="<?php echo U('home/perform/publish_term'); ?> "> <div class="modal-body"> <div class="form-group"> <label>
public function images($page = 1) { if (mc_user_id()) { if (mc_is_admin()) { $this->content = M('attached')->order('id desc')->page($page, 20)->select(); $count = M('page')->where($condition)->count(); $this->assign('count', $count); $this->assign('page_now', $page); $this->theme(mc_option('theme'))->display('Control/images'); } else { $this->error('您没有权限访问此页面!'); } } else { $this->success('请先登陆', U('User/login/index')); } }
public function pro_down($id) { if (mc_is_admin() || mc_is_bianji()) { $pro_id = mc_prev_page_id($id); if ($pro_id > 0) { $date = mc_get_page_field($pro_id, 'date'); $page['date'] = $date - 1; M('page')->where("id='{$id}' AND type='pro'")->save($page); } $this->success('操作成功!'); } else { $this->error('请不要放弃治疗'); } }
</div> </div> <?php } else { ?> <?php mc_template_part('sidebar'); ?> <?php } ?> </div> </div> </div> <?php if (mc_is_admin() || mc_is_group_admin(mc_get_meta($val['id'], 'group'))) { ?> <!-- Modal --> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog modal-sm"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> × </button> <h4 class="modal-title" id="myModalLabel"> </h4> </div> <div class="modal-body text-center"> 确认要删除这篇文章吗?
public function ip_false($id) { if (is_numeric($id)) { if (mc_is_admin()) { if (mc_get_meta($id, 'user_level', true, 'user') != 10) { $ip_array = M('action')->where("page_id='{$id}' AND action_key='ip'")->getField('action_value', true); if ($ip_array) { foreach ($ip_array as $ip) { mc_add_option('ip_false', $ip, 'user'); } } mc_delete_page($id); $this->success('操作成功', U('Home/index/index')); } else { $this->error('请不要伤害管理员'); } } else { $this->error('哥们,请不要放弃治疗!', U('Home/index/index')); } } else { $this->error('参数错误!'); } }
public function mysqlin() { if (mc_is_admin()) { $fileName = THINK_PATH . '../db.php'; if (!is_writeable($fileName)) { @chmod($fileName, 0777); } $json = file_get_contents($fileName); $mysqls = unserialize($json); foreach ($mysqls as $table => $mysql) { M($table)->data($mysql)->add(); } $this->success('数据导入成功!', mc_site_url()); } else { $this->error('凡人,请远离是非之地!', mc_site_url()); } }
public function site_nav() { if (mc_is_admin()) { if ($_POST['nav_control']) { mc_add_option(I('param.nav_text'), I('param.nav_link'), 'nav'); $this->success('保存成功', U('Home/index/index')); } else { $this->error('提交参数错误!'); } } else { $this->success('请先登陆', U('User/login/index')); } }
public function add_topic() { if (mc_is_admin() || mc_is_bianji()) { $this->theme('admin')->display('Publish/add_topic'); } else { $this->success('请先登陆', U('User/login/index')); } }
public function add_weixin() { if (mc_is_admin() && $_POST['fileup'] == 'ok') { $file_name = $_FILES['file']['name']; //获取文件扩展名 $temp_arr = explode(".", $file_name); $file_ext = array_pop($temp_arr); $file_ext = trim($file_ext); $file_ext = strtolower($file_ext); //创建文件 $new_files = "./Public/weixin/" . $file_name; move_uploaded_file($_FILES["file"]["tmp_name"], $new_files); $filex = $new_files; $appid = mc_option('weixin_appid'); $appsecret = mc_option('weixin_appsecret'); $access_token = mc_get_access_token($appid, $appsecret); $callback = mc_upload_media($filex, $access_token); $this->assign('callback', $callback); $this->theme('admin')->display('Publish/add_weixin'); } else { $this->error('未知错误!', U('home/index/index')); } }
public function site_nav2() { if (mc_is_admin()) { if ($_POST['nav_control']) { if ($_POST['nav_blank'] > 0) { mc_add_option(I('param.nav_text'), I('param.nav_link'), 'nav4'); } else { mc_add_option(I('param.nav_text'), I('param.nav_link'), 'nav3'); } $this->success('保存成功'); } else { $this->error('提交参数错误!'); } } else { $this->success('请先登陆'); } }