/// <summary> /// 增加管理日志 /// </summary> /// <param name="用户id"></param> /// <param name="用户名"></param> /// <param name="操作类型"></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 = TWRequest.GetIP(); return(dal.Add(manager_log_model)); }
/// <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 = TWRequest.GetIP(); model.login_time = DateTime.Now; return(dal.Add(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.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.address = Utils.DropHTML(txtAddress.Text.Trim()); model.amount = Utils.StrToInt(txtAmount.Text.Trim(), 0); model.point = Utils.StrToInt(txtPoint.Text.Trim(), 0); model.reg_time = DateTime.Now; model.reg_ip = TWRequest.GetIP(); if (TWRequest.GetFormString("txt_guo") == "台灣") { model.area = TWRequest.GetFormString("txt_guo") + "," + TWRequest.GetFormString("txt_state") + "," + TWRequest.GetFormString("txt_city"); } else { model.area = TWRequest.GetFormString("txt_guo") + "," + TWRequest.GetFormString("txt_state1") + "," + TWRequest.GetFormString("txt_city1"); } model.qq = TWRequest.GetFormString("txt_zip"); if (cbExp.Checked) { model.exp = 1; } else { model.exp = 0; } if (bll.Add(model) > 0) { AddAdminLog(TWEnums.ActionEnum.Add.ToString(), "添加用戶:" + model.user_name); //記錄日誌 result = true; } return(result); }
//第三方登入後處理 protected void multi_login(string id, string name, string email, string source) { Tea.Model.users model = new Tea.Model.users(); Tea.BLL.users bll = new Tea.BLL.users(); //自動加入會員 DataSet ds = bll.GetList(1, "user_name='" + id + "'", "id"); //Response.Write(ds.Tables[0].Rows.Count); if (ds.Tables[0].Rows.Count == 0) { if (!string.IsNullOrEmpty(email) && email.Length > 5) { if (new Tea.BLL.users().ExistsEmail(email)) { Response.Write(ljd.function.LocalHint("此帳號信箱已存在於此網站,請以新mail註冊", "/users/login.aspx")); Response.End(); } } model.group_id = 1; model.status = 0; model.user_name = id; model.password = DESEncrypt.Encrypt(ljd.function.getUUIDString(12)); model.email = email; // txtEmail.Text; //model.birthday = DateTime.Parse("1980-1-1"); model.nick_name = name; //txtNickName.Text; model.mobile = ""; //txtTelphone.Text.Trim(); model.address = ""; //Request["txtcity"] + "|" + Request["txtcity1"] + "|" + txtZip.Text + "|" + txtAddress.Text.Trim(); model.reg_time = DateTime.Now; model.reg_ip = TWRequest.GetIP(); model.user_hei = 2; int uid = bll.Add(model); model = bll.GetModel(uid); //model.id = uid; } else { model = bll.GetModel(id); if (model == null) { Response.Write(ljd.function.LocalHint("您已更改本站密碼,請用本站密碼登入!", "/users/login.aspx")); Response.End(); } } //防止Session提前過期 try { Session[TWKeys.SESSION_USER_INFO] = model; Session.Timeout = 4500; //防止Session提前過期 Utils.WriteCookie(TWKeys.COOKIE_USER_NAME_REMEMBER, "Tea", model.user_name); Utils.WriteCookie(TWKeys.COOKIE_USER_PWD_REMEMBER, "Tea", model.password); Tea.Model.cart_total cartModel = Tea.Web.UI.ShopCart.GetTotal(1); if (cartModel.total_quantity == 0) { Response.Redirect("/Default.aspx"); } else { Response.Redirect("/shop/cart.aspx"); } //寫入登入日誌 // new Tea.BLL.user_login_log().Add(model.id, model.user_name, "會員登入", TWRequest.GetIP()); } catch { Response.Write("no"); } //寫入登入日誌 //new Tea.BLL.user_login_log().Add(model.id, model.user_name, id + "會員登入", TWRequest.GetIP()); //Response.Write(model.id+"--"+model.user_name+"--"+model.email); }
protected void Page_Load(object sender, EventArgs e) { id = Request["id"]; name = Request["name"]; if (!string.IsNullOrEmpty(id)) { Tea.Model.users model = new Tea.Model.users(); Tea.BLL.users bll = new Tea.BLL.users(); //自動加入會員 DataSet ds = bll.GetList(1, "user_name='" + id + "'", "id"); if (ds.Tables[0].Rows.Count == 0) { model.group_id = 1; model.status = 0; model.user_name = id; model.password = DESEncrypt.Encrypt(ljd.function.getUUIDString(12)); //model.birthday = DateTime.Parse("1980-1-1"); if (!string.IsNullOrEmpty(name)) { model.nick_name = name; } else { model.nick_name = "暱名"; } model.mobile = ""; model.address = ""; model.reg_time = DateTime.Now; model.reg_ip = TWRequest.GetIP(); model.user_hei = 1; model.point = 0; model.avatar = "https://graph.facebook.com/" + id + "/picture"; try { string tcode = Utils.GetCookie("tcode"); model.company = Utils.StrToInt(tcode, 0); } catch (Exception eee) { } int uid = bll.Add(model); model.id = uid; Session[TWKeys.SESSION_USER_INFO] = model; Session.Timeout = 4500; //防止Session提前過期 Utils.WriteCookie(TWKeys.COOKIE_USER_NAME_REMEMBER, "Tea", model.user_name); Utils.WriteCookie(TWKeys.COOKIE_USER_PWD_REMEMBER, "Tea", model.password); //寫入登入日誌 //new Tea.BLL.user_login_log().Add(); if (model.email.Length < 2) { Response.Write("2"); Response.End(); } Response.Write("1"); Response.End(); } else { model = bll.GetModel(id); model.avatar = "https://graph.facebook.com/" + id + "/picture"; bll.Update(model); if (model == null) { //Response.Write(Tea.Common.Utils.LocalHint("您已更改本站密碼,請用本站密碼登入!", "/login.aspx")); //Response.End(); } } //防止Session提前過期 try { Session[TWKeys.SESSION_USER_INFO] = model; Session.Timeout = 4500; //防止Session提前過期 Utils.WriteCookie(TWKeys.COOKIE_USER_NAME_REMEMBER, "Tea", model.user_name); Utils.WriteCookie(TWKeys.COOKIE_USER_PWD_REMEMBER, "Tea", model.password); //寫入登入日誌 //new Tea.BLL.user_login_log().Add(model.id, model.user_name, "會員登入", TWRequest.GetIP()); if (model.email.Length < 2) { Response.Write("2"); Response.End(); } Response.Write("1"); Response.End(); Tea.Model.cart_total cartModel = Tea.Web.UI.ShopCart.GetTotal(1); if (cartModel.total_quantity == 0) { Response.Write("3"); Response.End(); } else { Response.Write("4"); Response.End(); } } catch {// Response.Write("no"); Response.End(); } } }
protected void Page_Load(object sender, EventArgs e) { act = Request["act"]; Tea.BLL.users bll = new Tea.BLL.users(); data_guo.DataSource = Tea.DBUtility.DbHelperSQL.Query("select * from shop_basic where basic_where='city' order by basic_sort"); data_guo.DataBind(); if (act == "act_reg") { string remember = TWRequest.GetFormString("txt_code"); if (Session[TWKeys.SESSION_CODE] == null) { Response.Write(ljd.function.LocalHint("系統找不到驗證碼", "reg.aspx")); return; } if (remember.ToLower() != Session[TWKeys.SESSION_CODE].ToString().ToLower()) { Response.Write(ljd.function.LocalHint("驗證碼輸入不正確", "reg.aspx")); return; } string username = Utils.ToHtml(TWRequest.GetFormString("email").Trim()); string password = TWRequest.GetFormString("loginPwd").Trim(); string email = Utils.ToHtml(TWRequest.GetFormString("email").Trim()); string mobile = Utils.ToHtml(TWRequest.GetFormString("cellPhone").Trim()); string address = Utils.ToHtml(TWRequest.GetFormString("address").Trim()); string area = Utils.ToHtml(TWRequest.GetFormString("txt_state").Trim()); string city = Utils.ToHtml(TWRequest.GetFormString("txt_city").Trim()); string area1 = Utils.ToHtml(TWRequest.GetFormString("txt_state1").Trim()); string city1 = Utils.ToHtml(TWRequest.GetFormString("txt_city1").Trim()); string guo = Utils.ToHtml(TWRequest.GetFormString("txt_guo").Trim()); string sex = TWRequest.GetFormString("rblSex").Trim(); string birthday = TWRequest.GetFormString("birthdayY").Trim() + "-" + TWRequest.GetFormString("birthdayM").Trim() + "-" + TWRequest.GetFormString("birthdayD").Trim(); string nickname = TWRequest.GetFormString("userName").Trim(); int rss = TWRequest.GetFormInt("rss", 0); string userip = TWRequest.GetIP(); //檢查用戶輸入資料是否為空 if (username == "" || password == "") { Response.Write(ljd.function.LocalHint("用戶名和密碼不能為空!", "")); return; } //檢查用戶名 Tea.Model.users model = new Tea.Model.users(); if (new Tea.BLL.users().ExistsEmail(email)) { Response.Write(ljd.function.LocalHint("此帳號信箱已存在於此網站,請以新mail註冊", "")); Response.End(); return; } if (bll.Exists(username)) { Response.Write(ljd.function.LocalHint("對不起,該用戶名已經存在!", "")); Response.End(); return; } //儲存註冊資料 model.group_id = 1; model.user_name = username; model.salt = Utils.GetCheckCode(6); model.status = 1; model.password = DESEncrypt.Encrypt(password, model.salt); model.email = email; model.mobile = mobile; if (guo == "台灣") { model.area = guo + "," + area + "," + city; } else { model.area = guo + "," + area1 + "," + city1; } model.qq = TWRequest.GetFormString("txt_zip"); model.sex = sex; model.address = address; try { model.birthday = System.DateTime.Parse(birthday); } catch (Exception eee) { Response.Write(ljd.function.LocalHint("請輸入正確的日期!", "")); return; } if (TWRequest.GetFormInt("birthdayY") < 1900 || TWRequest.GetFormInt("birthdayY") > System.DateTime.Now.Year) { Response.Write(ljd.function.LocalHint("請輸入正確的日期!", "")); Response.End(); return; } model.nick_name = nickname; model.reg_ip = userip; model.reg_time = DateTime.Now; model.exp = rss; model.user_hei = 0; int newId = bll.Add(model); if (newId < 1) { Response.Write(ljd.function.LocalHint("系統故障,請聯絡網站管理員!", "")); return; } model = bll.GetModel(newId); try { string mailTitle = "驗證郵箱通知信", mailContent = ""; string url = weburl + "mail/reg.aspx?id=" + newId, ss = ""; mailContent = ljd.function.GetPage(url, out ss); //發送郵件 TWMail.sendMail(config.emailsmtp, config.emailssl, config.emailport, config.emailusername, config.emailpassword, config.emailnickname, config.emailfrom, model.email, mailTitle, mailContent); } catch (Exception eee) { } if (model != null) { Session[TWKeys.SESSION_USER_INFO] = model; Session.Timeout = 45; //防止Session提前過期 Utils.WriteCookie(TWKeys.COOKIE_USER_NAME_REMEMBER, "Tea", model.user_name); Utils.WriteCookie(TWKeys.COOKIE_USER_PWD_REMEMBER, "Tea", model.password); //寫入登入日誌 new Tea.BLL.user_login_log().Add(model.id, model.user_name, "會員登入"); Response.Write(ljd.function.LocalHint("已發送帳號啟用信至您的電子信箱,請至信箱確認並啟用。", "regno.aspx")); Response.End(); } } }