function admin_login() { if (isset($_POST['dosubmit'])) { $um = new usermodel("admin_user"); //获得post数据 $username = $_POST['username']; $password = $_POST['password']; $verifycode = $_POST['verifycode']; //验证post数据 if (strtolower($_SESSION['verifycode']) != $verifycode) { $this->jump("验证码不正确", 0); } if (empty($username) || empty($password)) { $this->jump("用户名密码为空", 0); } //验证通过 //md5密码验证 $data = $um->excute("select * from admin_user where username='******'"); if ($data[0]["password"] == md5($password)) { $_SESSION['admin_user'] = array("uid" => $data[0]['userid'], "username" => $data[0]['username']); $this->jump("登录成功", 1, "/tcphp/index.php/admin/index/main"); } else { $this->jump("用户名密码错误", 0); } } else { $this->display(); } }
public function userupdate() { if (isset($_POST['dosubmit'])) { $usermodel = new usermodel('admin_user'); if (isset($_POST['username'])) { $data['username'] = $_POST['username']; } if (isset($_POST['email'])) { $data['email'] = $_POST['email']; } if (isset($_POST['roleid'])) { $data['roleid'] = $_POST['roleid']; } if (isset($_POST['status'])) { $data['status'] = $_POST['status']; } $userid = $_GET['userid']; $row = $usermodel->update($data, array("where" => "userid={$userid}")); if ($row < 0) { $returndata = array("errorMsg" => '用户更新失败'); } else { $returndata = array("successMsg" => '用户更新成功'); } $this->ajaxReturn($returndata); } }
public function userdelete() { if (isset($_POST['userid'])) { $userid = intval($_POST['userid']); } $usermodel = new usermodel('admin_user'); if ($usermodel->delete(array('where' => "userid={$userid}"))) { $returndata = array("successMsg" => '用户删除成功'); } else { $returndata = array("errorMsg" => '用户删除失败'); } $this->ajaxReturn($returndata); }