protected void btnSubmit_Click(object sender, EventArgs e) { string userName = txtUserName.Value.Trim(); string userPwd = txtPassword.Value.Trim(); //判断登录信息 userPwd = FormsAuthentication.HashPasswordForStoringInConfigFile(userPwd, "MD5"); //Response.Write(userPwd); //Response.End(); if (tbl_admin.Exists(userName, userPwd)) { tbl_admin myuser = new tbl_admin(); string sqlGetUserID = "select id from [tbl_admin] where huiyuan_bianhao='" + userName + "'"; int userid = Convert.ToInt16(DbHelperSQL.GetSingle(sqlGetUserID)); myuser.GetModel(userid); //判断账号是否被禁用 if (Convert.ToInt32(myuser.is_lock) == 1) { MessageBox.errorShow(this.Page, "您的账号被禁用,请联系客服!"); return; } //写入登录日志 tbl_login login_log = new tbl_login(); login_log.huiyuan_bianhao = userName; login_log.huiyuan_name = myuser.huiyuan_name; login_log.login_date = DateTime.Now; login_log.login_flag = 1; login_log.huiyuan_ip = AXRequest.GetIP(); login_log.Add(); //写入Cookies Utils.WriteCookie("hy_id", myuser.huiyuan_id, 14400); Utils.WriteCookie("hy_bianhao", userName, 14400); Utils.WriteCookie("hy_name", myuser.huiyuan_name, 14400); Utils.WriteCookie("RoleID", myuser.role_id.ToString(), 14400); //写入Session Session["hy_id"] = myuser.huiyuan_id; Session["hy_bianhao"] = userName; Session["hy_name"] = myuser.huiyuan_name; Session["RoleID"] = myuser.role_id.ToString(); Session.Timeout = 45; Response.Redirect("index.aspx"); return; } else { MessageBox.errorShow(this.Page, "账号或密码有误,请重试!"); return; } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(int user_id, string user_name, string remark) { Model.user_login_log model = new Model.user_login_log(); model.user_id = user_id; model.user_name = user_name; model.remark = remark; model.login_ip = AXRequest.GetIP(); model.login_time = DateTime.Now; return(dal.Add(model)); }
/// <summary> /// 增加管理日志 /// </summary> /// <param name="用户id"></param> /// <param name="" + Resources.lang.username+ ""></param> /// <param name="" + Resources.lang.operating+ "类型"></param> /// <param name="备注"></param> /// <returns></returns> public int Add(int user_id, string user_name, string action_type, string remark) { Model.manager_log manager_log_model = new Model.manager_log(); manager_log_model.user_id = user_id; manager_log_model.user_name = user_name; manager_log_model.action_type = action_type; manager_log_model.remark = remark; manager_log_model.user_ip = AXRequest.GetIP(); return(dal.Add(manager_log_model)); }
private bool DoAdd() { bool result = false; Model.users model = new Model.users(); BLL.users bll = new BLL.users(); model.group_id = int.Parse(ddlGroupId.SelectedValue); model.express_id = int.Parse(ddlExpressId.SelectedValue); model.status = int.Parse(rblStatus.SelectedValue); //检测用户名是否重复 if (bll.Exists(txtUserName.Text.Trim())) { return(false); } model.user_name = Utils.DropHTML(txtUserName.Text.Trim()); //获得6位的salt加密字符串 model.salt = Utils.GetCheckCode(6); //以随机生成的6位字符串做为密钥加密 model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt); model.email = Utils.DropHTML(txtEmail.Text); model.nick_name = Utils.DropHTML(txtNickName.Text); model.avatar = Utils.DropHTML(txtAvatar.Text); model.sex = rblSex.SelectedValue; DateTime _birthday; if (DateTime.TryParse(txtBirthday.Text.Trim(), out _birthday)) { model.birthday = _birthday; } model.telphone = Utils.DropHTML(txtTelphone.Text.Trim()); model.mobile = Utils.DropHTML(txtMobile.Text.Trim()); model.qq = Utils.DropHTML(txtQQ.Text); model.address = Utils.DropHTML(txtAddress.Text.Trim()); model.amount = decimal.Parse(txtAmount.Text.Trim()); model.point = int.Parse(txtPoint.Text.Trim()); model.exp = int.Parse(txtExp.Text.Trim()); model.reg_time = DateTime.Now; model.reg_ip = AXRequest.GetIP(); if (bll.Add(model) > 0) { AddAdminLog(AXEnums.ActionEnum.Add.ToString(), "添加用户:" + model.user_name); //记录日志 result = true; } return(result); }
/// <summary> /// 写入管理日志 /// </summary> /// <param name="action_type"></param> /// <param name="remark"></param> /// <returns></returns> public bool AddAdminLog(string action_type, string remark) { //写入日志 tbl_login mylog = new tbl_login(); mylog.huiyuan_bianhao = Session["hy_bianhao"].ToString(); mylog.huiyuan_name = Session["hy_name"].ToString(); mylog.login_date = DateTime.Now; mylog.login_flag = 1; mylog.huiyuan_ip = AXRequest.GetIP(); int newId = mylog.Add(); if (newId > 0) { return(true); } return(false); }
/// <summary> /// 写入管理日志 /// </summary> /// <param name="action_type"></param> /// <param name="remark"></param> /// <returns></returns> public bool AddAdminLog(string action_type, string remark) { //写入日志 ps_manager_log mylog = new ps_manager_log(); mylog.user_id = Convert.ToInt32(Session["AID"]); mylog.user_name = Session["RememberName"].ToString(); mylog.action_type = action_type; mylog.add_time = DateTime.Now; mylog.remark = remark; mylog.user_ip = AXRequest.GetIP(); int newId = mylog.Add(); if (newId > 0) { return(true); } return(false); }
protected void ibtnLogin_Click(object sender, EventArgs e) { TextBox txtname = (TextBox)((MasterPage)Master).FindControl("txtUserName"); TextBox txtpwd = (TextBox)((MasterPage)Master).FindControl("txtPassword"); TextBox Txtcode = (TextBox)((MasterPage)Master).FindControl("Txtcode"); if (Txtcode.Text == "") { Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "alert('您未输入验证码。');", true); //lblTip.Text = "您输入的验证码不正确,请重新输入。"; return; } if (Session["serverCode"] == null) { Response.Write("<script language=javascript>alert('验证码失效,刷新页面!');location.href='index.aspx';</script>"); Response.End(); } string sVCode = Session["serverCode"].ToString(); if (txtname.Text == "") { Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "alert('请输入用户名。');", true); //lblTip.Text = "您输入的验证码不正确,请重新输入。"; return; } if (txtpwd.Text == "") { Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "alert('请输入密码。');", true); //lblTip.Text = "您输入的验证码不正确,请重新输入。"; return; } if (Txtcode.Text != sVCode) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "alert('您输入的验证码不正确,请重新输入。');", true); //lblTip.Text = "您输入的验证码不正确,请重新输入。"; return; } string sUserName = Utils.Filter(txtname.Text.Trim()); string sPassWord = Utils.Filter(txtpwd.Text.Trim()); if (tbl_huiyuan.Existshui(sUserName, sPassWord) || tbl_huiyuan.Exists(sUserName, sPassWord)) { if (tbl_huiyuan.Existshui(sUserName, sPassWord)) { tbl_huiyuan model1 = new tbl_huiyuan(); model1.GetModel_hui_mob(sUserName); Session["hy_id1"] = model1.huiyuan_id; Session["hy_bianhao1"] = model1.huiyuan_bianhao; Session["hy_name1"] = model1.huiyuan_name; Session["hy_zm1"] = model1.huiyuan_zhuanmai; Session["hy_jiebie1"] = model1.huiyuan_jiebie; //Session["zhongyao1"] = 1; //写入登录日志 tbl_login login_log = new tbl_login(); login_log.huiyuan_bianhao = sUserName; login_log.huiyuan_name = model1.huiyuan_name; login_log.login_date = DateTime.Now; login_log.login_flag = 2; login_log.huiyuan_ip = AXRequest.GetIP(); login_log.Add(); } if (tbl_huiyuan.Exists(sUserName, sPassWord)) { tbl_huiyuan model1 = new tbl_huiyuan(); model1.GetModel_hui_bianhao(sUserName); Session["hy_id1"] = model1.huiyuan_id; Session["hy_bianhao1"] = model1.huiyuan_bianhao; Session["hy_name1"] = model1.huiyuan_name; Session["hy_zm1"] = model1.huiyuan_zhuanmai; Session["hy_jiebie1"] = model1.huiyuan_jiebie; //Session["zhongyao1"] = 1; //写入登录日志 tbl_login login_log = new tbl_login(); login_log.huiyuan_bianhao = sUserName; login_log.huiyuan_name = model1.huiyuan_name; login_log.login_date = DateTime.Now; login_log.login_flag = 2; login_log.huiyuan_ip = AXRequest.GetIP(); login_log.Add(); } Utils.WriteCookie("ps_cookie_shopping_cart", "AoXiang", -14400); Response.Redirect("huiyuan/index.aspx"); return; } else { Response.Write("<script language=javascript>alert('账号或密码有误或被冻结,请重试!');location.href='login.aspx';</script>"); Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); //=============================获得订单信息================================ string order_no = AXRequest.GetFormString("pay_order_no").ToUpper(); decimal order_amount = AXRequest.GetFormDecimal("pay_order_amount", 0); string user_name = AXRequest.GetFormString("pay_user_name"); string subject = AXRequest.GetFormString("pay_subject"); //以下" + Resources.lang.Receiver+ "信息 string receive_name = string.Empty; //" + Resources.lang.Receiver+ "姓名 string receive_address = string.Empty; //" + Resources.lang.Receiver+ "地址 string receive_zip = string.Empty; //" + Resources.lang.Receiver+ "邮编 string receive_phone = string.Empty; //" + Resources.lang.Receiver+ "电话 string receive_mobile = string.Empty; //" + Resources.lang.Receiver+ "手机 //检查参数是否正确 if (order_no == "" || order_amount == 0) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!"))); return; } if (order_no.StartsWith("R")) //R开头为在线充值订单 { Model.user_amount_log model = new BLL.user_amount_log().GetModel(order_no); if (model == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单号不存在或已删除!"))); return; } if (model.value != order_amount) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的" + Resources.lang.amount + "与实际金额不一致!"))); return; } //取得用户信息 Model.users userModel = new BLL.users().GetModel(model.user_id); if (userModel == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,用户账户不存在或已删除!"))); return; } receive_name = userModel.nick_name; receive_address = userModel.address; receive_phone = userModel.telphone; receive_mobile = userModel.mobile; } else //B开头为商品订单 { Model.orders model = new BLL.orders().GetModel(order_no); if (model == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单号不存在或已删除!"))); return; } if (model.order_amount != order_amount) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的" + Resources.lang.amount + "与实际金额不一致!"))); return; } receive_name = model.accept_name; receive_address = model.address; receive_zip = model.post_code; receive_phone = model.telphone; receive_mobile = model.mobile; } if (user_name != "") { user_name = "支付会员:" + user_name; } else { user_name = "匿名用户"; } //===============================请求参数================================== //把请求参数打包成数组 SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); sParaTemp.Add("payment_type", "1"); //收款类型1商品购买 sParaTemp.Add("show_url", siteConfig.weburl); //商品展示地址 sParaTemp.Add("out_trade_no", order_no); //网站订单号 sParaTemp.Add("subject", siteConfig.webname + "-" + subject); //订单名称 sParaTemp.Add("body", user_name); //订单描述 sParaTemp.Add("total_fee", order_amount.ToString()); //订单总金额 sParaTemp.Add("paymethod", ""); //默认支付方式 sParaTemp.Add("defaultbank", ""); //默认网银代号 sParaTemp.Add("anti_phishing_key", ""); //防钓鱼时间戳 sParaTemp.Add("exter_invoke_ip", AXRequest.GetIP()); ////获取客户端的IP地址 sParaTemp.Add("buyer_email", ""); //默认买家支付宝账号 sParaTemp.Add("royalty_type", ""); sParaTemp.Add("royalty_parameters", ""); //构造即时到帐接口表单提交HTML数据,无需修改 Service ali = new Service(); string sHtmlText = ali.Create_direct_pay_by_user(sParaTemp); Response.Write(sHtmlText); }
protected void btnSubmit_Click(object sender, EventArgs e) { string userName = txtUserName.Value.Trim(); string userPwd = txtPassword.Value.Trim(); //判断登录信息 ps_manager myuser = new ps_manager(); string sqlGetUserID = "select id from [ps_manager] where user_name='" + userName + "'"; int userid = Convert.ToInt16(DbHelperSQL.GetSingle(sqlGetUserID)); myuser.GetModel(userid); if (myuser.password != null) { userPwd = FormsAuthentication.HashPasswordForStoringInConfigFile(userPwd, "MD5"); if (myuser.password.Trim() != userPwd) { MessageBox.errorShow(this.Page, "账号或密码有误,请重试!"); return; } //判断账号是否被禁用 if (Convert.ToInt32(myuser.is_lock) == 2) { MessageBox.errorShow(this.Page, "您的账号被禁用,请联系客服!"); return; } ps_depot myd = new ps_depot(); myd.GetModel(Convert.ToInt32(myuser.depot_id)); //判断账号对应的商家是否被禁用 if (Convert.ToInt32(myuser.depot_id) != 0 && Convert.ToInt32(myd.status) == 2) { MessageBox.errorShow(this.Page, "您所在商家被禁用,请联系客服!"); return; } //写入登录日志 ps_manager_log mylog = new ps_manager_log(); mylog.user_id = userid; mylog.user_name = userName; mylog.action_type = "登陆"; mylog.add_time = DateTime.Now; mylog.remark = "登陆系统"; mylog.user_ip = AXRequest.GetIP(); mylog.Add(); //写入Cookies Utils.WriteCookie("RememberName", userName, 14400); Utils.WriteCookie("AdminName", userName, 14400); Utils.WriteCookie("RoleID", myuser.role_id.ToString(), 14400); Utils.WriteCookie("AID", myuser.id.ToString(), 14400); Utils.WriteCookie("RealName", myuser.real_name, 14400); Utils.WriteCookie("DepotID", myuser.depot_id.ToString(), 14400); Utils.WriteCookie("DepotCatID", myuser.depot_category_id.ToString(), 14400); //写入Session Session["RememberName"] = userName; Session["AdminName"] = userName; Session["RoleID"] = myuser.role_id.ToString(); Session["AID"] = myuser.id.ToString(); Session["RealName"] = myuser.real_name; Session["DepotID"] = myuser.depot_id.ToString(); Session["DepotCatID"] = myuser.depot_category_id.ToString(); Session.Timeout = 45; Response.Redirect("main.aspx"); return; } else { MessageBox.errorShow(this.Page, "账号或密码有误,请重试!"); return; } }