public function changePass() { if (!v_islogin()) { $this->error('请登录', U("Admin/User/Login")); } else { if (IS_POST) { $password = I('param.password'); $newpass = I('param.new-password'); $map['username'] = $_SESSION['admin_user']; $map['password'] = md5($password); $count = M('user')->where($map)->select(); // 查询满足要求的总记录数 $map表示查询条件 if ($count) { //change print_r($count[0]['password']); $count[0]['password'] = md5($newpass); M('user')->data($count[0])->save(); $this->success('修改成功', U("Admin/User/profile"), 3); } else { //no change $this->error('旧密码错误,请重新输入', U("Admin/User/profile"), 5); } } else { $this->theme(v_option('theme'))->display('Admin/profile'); } } }
public function index() { if (!v_islogin()) { $this->success('请登录', U("Admin/User/Login")); } else { $this->theme(v_option('theme'))->display('Admin/index'); } }
/** * 删除 */ public function delete($id) { if (!v_islogin()) { $this->success('请登录', U("Admin/User/Login")); } else { if (!is_numeric($id)) { $this->error('参数错误'); } $m = M("page"); $result = $m->where('id=' . $id)->delete(); if ($result) { $this->success('删除成功.'); } else { $this->error('删除失败,请重试.'); } } }
/** * 保存 */ public function categorysave() { if (!v_islogin()) { $this->success('请登录', U("Admin/User/Login")); } else { if (IS_POST) { $page['id'] = I('param.id'); $page['sub_id'] = I('param.sub_id'); $page['name'] = I('param.name'); $page['summary'] = I('param.summary'); $page['img'] = I('param.img'); $page['order'] = I('param.order'); $page['img'] = substr($page['img'], 0, strlen($page['img']) - 2); $page['created'] = time(); $page['lang'] = LANG_SET; if ($page['sub_id'] == 0) { $page['top'] = "top"; } if ($page['id'] == "") { $result = M('product_category')->data($page)->add(); } else { $result = M('product_category')->data($page)->save(); } $this->success('发布成功.'); } else { $this->error('你干啥呢?'); } } }
/** * 保存 */ public function categorysave() { if (!v_islogin()) { $this->success('请登录', U("Admin/User/Login")); } else { if (IS_POST) { $page['id'] = I('param.id'); $page['name'] = I('param.name'); $page['desc'] = I('param.desc'); $page['lang'] = LANG_SET; $page['created'] = time(); if ($page['id'] == "") { $result = M('article_category')->data($page)->add(); } else { $result = M('article_category')->data($page)->save(); } $this->success('发布成功.'); } else { $this->error('你干啥呢?'); } } }
public function redelete($id) { if (!v_islogin()) { $this->error('请登录', U("Admin/User/Login")); } else { if (!is_numeric($id)) { $this->error('参数错误'); } $cork = M("cork")->where('id=' . $id)->select(); //->delete(); $openid = $cork[0]["openid"]; $cork[0]["openid"] = substr($openid, 0, strripos($openid, "_")); $cork[0]["del"] = "0"; $result = M('cork')->data($cork[0])->save(); if ($result) { $this->success('恢复成功.'); } else { $this->error('恢复失败,请重试.'); } } }
public function saveEmail() { // // print_r("<pre>"); // print_r($_POST); // print_r("</pre>"); // die; if (!v_islogin()) { $this->success('请登录', U("Admin/User/Login")); } else { if (IS_POST) { $requestdata = $_POST; foreach ($requestdata['id'] as $value) { $page = array(); $page['id'] = $value; $page['meta_key'] = $requestdata['meta_key'][$value]; $page['meta_value'] = $requestdata['meta_value'][$value]; $page['type'] = $requestdata['type'][$value]; M('option')->data($page)->save(); } $this->success('发布成功.'); } else { $this->error('你干啥呢?'); } } }