protected void Button_login_Click(object sender, EventArgs e) { string account = TextBox_account.Text.Trim(); string password = TextBox_psw.Text.Trim(); if (account.Equals("")) { Label_TipInfo.Text = "请输入您的帐号信息!"; return; } if (password.Equals("")) { Label_TipInfo.Text = "请输入您的密码信息!"; return; } string psw = UserTool.Get(account, "Password"); if (psw.Equals(password)) { Label_TipInfo.Text = "登录成功!"; UserTool.SaveAccount(Session, account, password); // 记录帐号密码信息 UserTool.CountLogin(account); // 统计登录次数 Response.Redirect("SDK.aspx"); } else { Label_TipInfo.Text = "密码不正确!"; } }
protected void Button_register_Click(object sender, EventArgs e) { string Account = TextBox_account.Text.Trim(); string Password = TextBox_psw.Text.Trim(); string Phone = TextBox_phone.Text.Trim(); string IdCard = TextBox_IdCard.Text.Trim(); bool result = CheckInput(Account, Password, Phone, IdCard); if (result) { // 判断帐号是否存在,若帐号不存在则添加 bool isExit = UserTool.Exist(Account); if (isExit) { Label_TipInfo.Text = "帐号“" + Account + "”已存在,请使用其它昵称!"; } else { string msg = UserTool.Add(Account, Password, Phone, IdCard); Label_TipInfo.Text = "恭喜,帐号注册成功!"; //ScTool.Alert("恭喜,帐号注册成功!"); Response.Redirect("UserLogin.aspx?Account=" + Account); } } }
/// <summary> /// 获取当前登录的用户类型信息 /// /// 0:未登录 1:普通用户 2:管理员 /// </summary> /// <param name="session"></param> /// <returns></returns> public static int UserType(HttpSessionState session) { String account = GetAccount(session); // 获取Session中保存的帐号信息 if (account.Equals("")) { return(0); } String password = GetPassword(session); // 获取Session中保存的密码信息 string psw = UserTool.Get(account, "Password"); // 查询用户密码信息 if (!psw.Equals(password)) { return(0); // 不相同则未登录 } if (account.Equals("scimence")) { return(2); } else { return(1); } }
protected void Page_Load(object sender, EventArgs e) { account = UserTool.GetAccount(Session); if (!account.Equals("")) { LabelLogin.Text = account; } }
protected void Page_Load(object sender, EventArgs e) { if ((!Page.IsPostBack)) { ScTool.RecordUserAgent(Request); // 记录客户端信息 } UserTool.InitTool(); UserTool.ClearAccount(Session); string Account = Request["Account"]; if (Account != null && !Account.Equals("")) { TextBox_account.Text = Account; } }
protected void Button_register_Click(object sender, EventArgs e) { string account = TextBox_account.Text.Trim(); string phone = TextBox_phone.Text.Trim(); string Id = TextBox_IdCard.Text.Trim(); string password = TextBox_psw.Text.Trim(); bool result = CheckInput(account, password, phone, Id); if (result) { Dictionary <String, String> row = UserTool.Get(account); if (!row.ContainsKey("Account")) { Label_TipInfo.Text = "帐号“" + account + "”不存在!"; } else { if (!row.ContainsKey("Phone") || !row["Phone"].Equals(phone)) { Label_TipInfo.Text = "手机号“" + phone + "”不正确!"; } else if (!row.ContainsKey("IdCard") || !row["IdCard"].Equals(Id)) { Label_TipInfo.Text = "身份证号不正确!"; } else { string msg = UserTool.Update(row["ID"], null, password, null, null, null, null, null, null, null); if (msg.Equals("success")) { Response.Redirect("UserLogin.aspx?Account=" + account); } else { Label_TipInfo.Text = "重置密码失败!"; } } } } }
protected void Page_Load(object sender, EventArgs e) { UserTool.InitTool(); }