protected void btnsubmit_Click(object sender, EventArgs e) { if (txtpass1.Text == "" && txtpass2.Text == "") { SystemTool.AlertShow(this, "密码不能为空!"); return; } if (txtpass1.Text != "" || txtpass2.Text != "") { if (txtpass1.Text.Trim() != txtpass2.Text.Trim()) { SystemTool.AlertShow(this, "两次密码不一致!"); return; } } if (txtpass1.Text != "") { string sql = "update manager_info set man_psw='" + SystemTool.jimi(txtpass1.Text) + "' where man_id=" + ViewState["userid"]; int i = DB.ExecuteSql(sql, null); if (i > 0) { SystemTool.AlertShow(this, "操作成功!"); } else { SystemTool.AlertShow(this, "操作失败!"); } } }
protected void btnok_Click(object sender, EventArgs e) { if (txtname.Text == "") { SystemTool.AlertShow(this, "管理员名称不能为空"); return; } if (txtpassok.Text != txtpassok2.Text) { SystemTool.AlertShow(this, "两次输入密码不一致"); return; } string sql = ""; int result = 0; if (null != Request.QueryString["manId"]) { //更新操作 if (txtpassok.Text == "") {//密码不更新 sql = "UPDATE manager_info set roleId='" + ddljiaose.SelectedValue + "',remark='" + SystemTool.NoHtml(txtbeizhu.Value) + "',state='" + ddlState.SelectedValue + "' where man_id=" + SystemTool.NoHtml(Request.QueryString["manId"]); } else { sql = "UPDATE manager_info set man_psw='" + SystemTool.jimi(SystemTool.NoHtml(txtpassok.Text)) + "',roleId='" + ddljiaose.SelectedValue + "',remark='" + SystemTool.NoHtml(txtbeizhu.Value) + "',state='" + ddlState.SelectedValue + "' where man_id=" + SystemTool.NoHtml(Request.QueryString["manId"]); } result = DB.ExecuteSql(sql, null); } else { sql = "select man_id from manager_info where man_name='" + SystemTool.NoHtml(txtname.Text) + "'"; string r = DB.ExecuteSqlValue(sql, null); if (r != "" && r != "no") { SystemTool.AlertShow(this, "管理员名称已存在"); return; } if (txtpassok.Text == "") { SystemTool.AlertShow(this, "管理员密码不能为空"); return; } sql = "insert into manager_info (man_name,man_psw,roleId,remark,state) values('" + SystemTool.NoHtml(txtname.Text) + "','" + SystemTool.jimi(SystemTool.NoHtml(txtpassok.Text)) + "'," + ddljiaose.SelectedValue + ",'" + SystemTool.NoHtml(txtbeizhu.Value) + "','" + ddlState.SelectedValue + "')"; result = DB.ExecuteSql(sql, null); } if (result > 0) { SystemTool.AlertShow_Refresh1(this, "保存成功", "guanliyuanlist.aspx"); } else { SystemTool.AlertShow(this, "保存失败"); return; } }
protected void btn_submit_Click(object sender, EventArgs e) { string name = SystemTool.NoHtml(txt_name.Text); string pass = SystemTool.NoHtml(txt_psw.Text); if (name == "" || pass == "") { SystemTool.AlertShow(this, "账户和密码不能为空"); return; } if (vCode.Value == "") { SystemTool.AlertShow(this, "验证码不能为空"); return; } if (Session["Code"] == null) { SystemTool.AlertShow(this, "验证码已过期"); return; } if (Session["Code"].ToString() != vCode.Value) { SystemTool.AlertShow(this, "验证码不正确"); return; } //string sql = "select man_id from manager_info where man_name='" + name + "' and man_psw='" + SystemTool.jimi(pass) + "'"; string sql = "select man_id,manager_info.state mstate,role_info.state rstate from manager_info,role_info where roleId=id and man_name='" + name + "' and man_psw='" + SystemTool.jimi(pass) + "'"; DataSet ds = DB.ExecuteSqlDataSet(sql, null); if (ds.Tables[0].Rows.Count == 0) { SystemTool.AlertShow(this, "账号或密码错误"); return; } if (ds.Tables[0].Rows[0]["mstate"].ToString() == "禁止") { SystemTool.AlertShow(this, "该用户被禁用"); return; } if (ds.Tables[0].Rows[0]["rstate"].ToString() == "禁止") { SystemTool.AlertShow(this, "该用户所在的组被禁用"); return; } //登录记录 //string area = SystemTool.GetAddressByIp(SystemTool.GetIP()); string ip = SystemTool.GetIP(); string dz = ""; //if (SystemTool.IsIP(ip)) { // dz = GetAddressByIp(ip); //} string managerid = ds.Tables[0].Rows[0]["man_id"].ToString(); string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //string sqlin = "insert into denglujilu(man_id,addtime,dengluip,dengludizhi) values(" + managerid + ",'" + time + "','" + ip + "','"+dz+"')"; //int result=DB.ExecuteSql(sqlin, null); //if (result <= 0) { // SystemTool.AlertShow(this, "网路连接错误,请重新登录"); // return; //} HttpCookie cookid = new HttpCookie(Cookie.ComplanyId, ds.Tables[0].Rows[0]["man_id"].ToString()); cookid.Expires = DateTime.Now.AddDays(1); Response.Cookies.Add(cookid); Response.Redirect("index.aspx"); // SystemTool.AlertShow_Refresh(this, "登录成功", "index.aspx"); }
protected void btn_submit_Click(object sender, EventArgs e) { string name = SystemTool.NoHtml(txt_name.Text); string pass = SystemTool.NoHtml(txt_psw.Text); if (name == "" || pass == "") { SystemTool.AlertShow(this, "账户和密码不能为空"); return; } if (vCode.Value == "") { SystemTool.AlertShow(this, "验证码不能为空"); return; } if (Session["Code"] == null) { SystemTool.AlertShow(this, "验证码已过期"); return; } if (Session["Code"].ToString() != vCode.Value) { SystemTool.AlertShow(this, "验证码不正确"); return; } //string sql = "select man_id from manager_info where man_name='" + name + "' and man_psw='" + SystemTool.jimi(pass) + "'"; string sql = "select man_id,manager_info.state mstate,role_info.state rstate from manager_info,role_info where roleId=id and man_name='" + name + "' and man_psw='" + SystemTool.jimi(pass) + "'"; DataSet ds = DB.ExecuteSqlDataSet(sql, null); if (ds.Tables[0].Rows.Count == 0) { SystemTool.AlertShow(this, "账号或密码错误"); return; } if (ds.Tables[0].Rows[0]["mstate"].ToString() == "禁止") { SystemTool.AlertShow(this, "该用户被禁用"); return; } if (ds.Tables[0].Rows[0]["rstate"].ToString() == "禁止") { SystemTool.AlertShow(this, "该用户所在的组被禁用"); return; } HttpCookie cookid = new HttpCookie(Cookie.ComplanyId, ds.Tables[0].Rows[0]["man_id"].ToString()); cookid.Expires = DateTime.Now.AddDays(1); Response.Cookies.Add(cookid); Response.Redirect("index.aspx"); }