zoukankan      html  css  js  c++  java
  • 登陆

        <table cellpadding="0" cellspacing="0" style=" 280px;" class="UsertdColor">
                        <tr>
                            <td style="vertical-align: bottom; height: 35px; text-align: center;  280px;">
                                <aspUser:UserText Caption="登录名称" ID="txtLoginName" ClientInstanceName="txtLoginName"
                                    runat="server" ValidationExpression="<%$ appSettings:登录名称 %>" ValidationToolTip="<%$ appSettings:登录名称Hint %>"
                                    ValidationGroup="Login" IsNotNull="true" ClientValueChanged="ShowAuthentication();" />
                            </td>
                        </tr>
                        <tr>
                            <td style="vertical-align: bottom; height: 35px; text-align: center;  280px;">
                                <aspUser:UserText Caption="登录密码" ID="txtPsw" runat="server" ValidationExpression="<%$ appSettings:登录密码 %>"
                                    ValidationToolTip="<%$ appSettings:登录密码Hint %>" IsPassword="true" ValidationGroup="Login" onpaste="return false"
                                    IsNotNull="true" />
                            </td>
                        </tr>
                    </table>

    后台:

        protected void butLongin_Click(object sender, EventArgs e)
        {
            if (txtLoginName.Text.Trim().Contains("'")
                || txtLoginName.Text.Trim().Contains(" ")
                || txtLoginName.Text.Trim().Contains("=")
                || txtLoginName.Text.Trim().ToLower().Contains(" or "))
            {
                lblLogin.Text = "系统不存在当前用户登录名称!";
                ErrorStat();
                return;
            }
            if (txtPsw.Text.Trim().Contains("'")
                || txtPsw.Text.Trim().Contains(" ")
                || txtPsw.Text.Trim().Contains("=")
                || txtPsw.Text.Trim().ToLower().Contains(" or "))
            {
                lblLogin.Text = "用户登录密码输入不正确!";
                ErrorStat();
                return;
            }
            string strsql = "select * from UserInfo where IsDeleted=0 and  LoginName ='" + txtLoginName.Text.Trim() + "'";
            DataTable tab = new DataTable();
            strsql = ZZ.Conn.Connection.getSqlTable(strsql, tab);
    
            if (strsql != string.Empty || tab == null)
            {
                PublicClass.setMessage(this, strsql);
                return;
            }
            if (tab.Rows.Count > 1 || tab.Rows.Count < 1)
            {
                lblLogin.Text = "系统不存在当前用户登录名称!";
                ErrorStat();
                return;
            }
    
            string User_ID = tab.Rows[0]["ID"].ToString().Trim();
            string LoginName = tab.Rows[0]["LoginName"].ToString().Trim();
            string authMess = proceAuthentication(User_ID, LoginName);
    
          if (tab.Rows[0]["Password"].ToString().Trim() != txtPsw.Text.Trim())
            {
                lblLogin.Text = "当前用户密码输入不正确!";
                ErrorStat();
                AuthMessMethod(authMess);
                return;
            }
    string userName = tab.Rows[0]["UserName"].ToString().Trim();
            string passWord = tab.Rows[0]["PassWord"].ToString().Trim();
    
            Session["UserID"] = User_ID;
            Session["UserName"] = userName;
            Session["LoginName"] = LoginName;
            Session["PassWord"] = passWord;
            string sql = @"SELECT ManpowerEmployee.Name FROM ManpowerPosition INNER JOIN ManpowerEmployee ON 
    ManpowerEmployee.ID = ManpowerPosition.ManpowerEmployee_ID 
    WHERE ManpowerPosition.ManpowerPositionType_ID IN (100,101) AND ManpowerEmployee.Name ='" + userName + "'";
            string UserPowerName = ZZ.Conn.Connection.getSqlValue(sql);
            if (tab.Rows[0]["IsChanges"].ToString().Trim() != "1")
            {
                HttpContext.Current.Session["ModuleName"] = "用户信息管理";
    
                Response.Redirect("ManpowerManage/SysUserManageEdit.aspx?type=3&UserId=" + User_ID + "&changetype=1");
            }
            if (UserPowerName != string.Empty)
            {
    
                string InsertSql = "exec InsertLive  '" + UserPowerName + "' ";
    
                using (SqlConnection con = new SqlConnection(ZZ.Conn.Connection.getDSN()))
                {
                    using (SqlCommand cmd = new SqlCommand(InsertSql, con))
                    {
                        con.Open();
                        int val = cmd.ExecuteNonQuery();
                        con.Close();
                    }
    
                }
            }
    
           
            Response.Redirect("~/Default.aspx");
        }
  • 相关阅读:
    《2019年软件工程助教培训计划》
    地铁线路项目-结对编程
    预培训-个人项目(地铁线路规划)
    粗读《构建之法》后的问题
    netapp 修改IP地址
    jump server 2.6.1 安装与配置
    CCNA-实验1-Manage_IOS
    系统结构综合实践期末大作业 第22组
    2017级系统综合实践第7次实践作业 01组
    2017级系统综合实践第6次实践作业 01组
  • 原文地址:https://www.cnblogs.com/Echo529/p/4556880.html
Copyright © 2011-2022 走看看