コード例 #1
0
        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 = "密码不正确!";
            }
        }
コード例 #2
0
ファイル: UserTool.cs プロジェクト: scimence/QrPaySystem
        /// <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);
            }
        }
コード例 #3
0
        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 = "重置密码失败!";
                        }
                    }
                }
            }
        }