Exemple #1
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        if (this.txt_username.Value == "")
        {
            this.RegisterClientScriptBlock("scripterror", "<script language=javascript>alert('请输入用户名!')</script>");
            return;
        }
        if (this.txt_password.Value == "")
        {
            this.RegisterClientScriptBlock("scripterror", "<script language=javascript>alert('请输入密码!')</script>");
            return;
        }

        String password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.txt_password.Value, "MD5");
        HyoaClass.Hyoa_user Users = new HyoaClass.Hyoa_user();

        if (Users.Login(this.txt_username.Value, password))
        {
            DataTable dt = Users.Getuserallinfo(this.txt_username.Value);
            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["hy_isenabled"].ToString() == "否")
                {
                    //账号被禁用了
                    this.RegisterClientScriptBlock("scripterror", "<script language=javascript>alert('该账号已被禁用,请联系管理员!')</script>");
                    return;
                }
                else
                {
                    Session["hyuid"] = this.txt_username.Value;
                    Session["hyuname"] = dt.Rows[0]["hy_username"].ToString();
                    Session["hydeptid"] = dt.Rows[0]["hy_deptid"].ToString();
                    Session["hydeptname"] = dt.Rows[0]["hy_deptname"].ToString();
                    Session["hypost"] = dt.Rows[0]["hy_post"].ToString(); ;
                    //得到风格
                    HyoaClass.Hyoa_mystyle Hyoa_mystyle = new HyoaClass.Hyoa_mystyle();
                    DataTable dt_mystyle = Hyoa_mystyle.Getstylebyuserid(this.txt_username.Value);
                    if (dt_mystyle.Rows.Count > 0 && dt_mystyle.Rows[0]["hy_style"].ToString() != "")
                        Session["mystyle"] = dt_mystyle.Rows[0]["hy_style"].ToString();
                    else
                        Session["mystyle"] = "/hyhtml/images/";

                    this.Response.Redirect(this.lblurl.Text);
                }
            }
            dt.Clear();
        }
        else
        {
            this.RegisterClientScriptBlock("scripterror", "<script language=javascript>alert('输入的用户名或者密码不正确!')</script>");
            return;
        }
    }
Exemple #2
0
    protected void WebPageOpen()
    {
        string ls_uid = "";
        string ls_pwd = "";
        string ls_key = "";
        string ls_url = "";

        if (this.Request.QueryString["uid"] != null)
            ls_uid = this.Request.QueryString["uid"].ToString();

        if (this.Request.QueryString["pwd"] != null)
            ls_pwd = this.Request.QueryString["pwd"].ToString();

        if (this.Request.QueryString["key"] != null)
            ls_key = this.Request.QueryString["key"].ToString();

        int pos = Request.RawUrl.IndexOf("&redirectto=");
        if (pos > 0)
            ls_url = this.Request.RawUrl.Substring(pos + 12);

        if (ls_key != "cd04fa144ec48507")
            Response.Write("<script language=javascript>alert('非常抱歉,您的访问地址有误,请联系管理员!');self.close();</script>");

        String password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(ls_pwd, "MD5");
        HyoaClass.Hyoa_user Users = new HyoaClass.Hyoa_user();

        if (Users.Login(ls_uid, password))
        {
            DataTable dt = Users.Getuserallinfo(ls_uid);
            if (dt.Rows.Count > 0)
            {
                Session["hyuid"] = ls_uid;
                Session["hyuname"] = dt.Rows[0]["hy_username"].ToString();
                Session["hydeptid"] = dt.Rows[0]["hy_deptid"].ToString();
                Session["hydeptname"] = dt.Rows[0]["hy_deptname"].ToString();
                this.Response.Redirect(ls_url);
            }
            dt.Clear();
        }
        else
        {
            this.Response.Redirect("/");
            return;
        }
    }
    //保存
    protected void Button_Save_Click(object sender, EventArgs e)
    {
        String password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.txtOldPass.Value, "MD5");
        HyoaClass.Hyoa_user Users = new HyoaClass.Hyoa_user();

        if (Users.Login(this.txtuserid.Value, password))
        {
            HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user();
            if (Hyoa_user.DoChPwd(this.txtuserid.Value, this.txtNewPass.Value))
            {
                Response.Write("<script>alert('修改密码成功!');self.close();</script>");
            }
        }
        else
        {
            Response.Write("<script>alert('旧密码不正确,请重新输入!');</script>");
            return;
        }
    }
Exemple #4
0
    //protected string IPlimted()
    //{
    //IP限制
    //string lscurip, configip, lsflag;
    //lsflag = "0";
    //lscurip = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
    ////return;
    //MagicPortalClass.DAO dbconfigip = new MagicPortalClass.DAO();
    //DataTable dtconfigip = dbconfigip.GetDataTable("select * from JpConfig where fdtype='ip'");
    //configip = dtconfigip.Rows[0]["fdname"].ToString();
    //dtconfigip.Clear();
    //dbconfigip.Close();
    //string[] lvconfigip = configip.Split(',');
    //for (var i = 0; i < lvconfigip.Length; i++)
    //{
    //    if (lvconfigip[i].Contains("-") == true)
    //    {
    //        string[] lvconfigipsub = lvconfigip[i].Split('-');
    //        string[] lvconfigipsub1 = lvconfigipsub[0].Split('.');
    //        string[] lvconfigipsub2 = lvconfigipsub[1].Split('.');
    //        string[] lvcurip = lscurip.Split('.');
    //        if (lvcurip[0] == lvconfigipsub1[0] & lvcurip[1] == lvconfigipsub1[1] & lvcurip[2] == lvconfigipsub1[2] & lvcurip[0] == lvconfigipsub2[0] & lvcurip[1] == lvconfigipsub2[1] & lvcurip[2] == lvconfigipsub2[2])
    //        {
    //            if ((int.Parse(lvcurip[3]) >= int.Parse(lvconfigipsub1[3]) & int.Parse(lvcurip[3]) <= int.Parse(lvconfigipsub2[3])))
    //            {
    //                lsflag = "1";
    //                break;
    //            }
    //            else
    //            {
    //                continue;
    //            }
    //        }
    //        else
    //        {
    //            continue;
    //        }
    //    }
    //    else
    //    {
    //        if (lvconfigip[i] == lscurip)
    //        {
    //            lsflag = "1";
    //            break;
    //        }
    //    }
    //}
    //return lsflag;
    ////this.aaaa.Value = lscurip;
    ///////////IP限制结束
    //}
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        //if (Session["checkcode"].ToString().Equals(this.txt_checkcode.Value))
        //{
            String password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.txt_password.Value, "MD5");
            HyoaClass.Hyoa_user Users = new HyoaClass.Hyoa_user();
            //Response.Write("<script>alert('aaaa');</script>");
            if (Users.Login(this.txt_username.Value, password))
            {
               // Response.Write("<script>alert('bbb');</script>");
                DataTable dt = Users.Getuserallinfo(this.txt_username.Value);
                if (dt.Rows.Count > 0)
                {
                    Session["hyuid"] = this.txt_username.Value;
                    Session["hyuname"] = dt.Rows[0]["hy_username"].ToString();
                    Session["hydeptid"] = dt.Rows[0]["hy_deptid"].ToString();
                    Session["hydeptname"] = dt.Rows[0]["hy_deptname"].ToString();

                    //登录日志 start
                    string ls_oppcontent = this.Session["hyuname"].ToString() + "登录";
                    HyoaClass.Hyoa_log Hyoa_log = new HyoaClass.Hyoa_log();
                    Hyoa_log.ID = System.Guid.NewGuid().ToString();
                    Hyoa_log.hy_createtime = System.DateTime.Now.ToString();
                    string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                    if (userip == null || userip == "")
                    {
                        userip = Request.ServerVariables["REMOTE_ADDR"];
                    }
                    Hyoa_log.hy_oppip = userip;
                    Hyoa_log.hy_opptype = "登录";
                    Hyoa_log.hy_oppcontent = ls_oppcontent;
                    Hyoa_log.hy_oppuserid = this.Session["hyuid"].ToString();
                    Hyoa_log.hy_oppusername = this.Session["hyuname"].ToString();
                    Hyoa_log.Insert();
                    //登录日志 end

                    HyoaClass.Hyoa_license Hyoa_license = new HyoaClass.Hyoa_license();
                    DataTable dtlicense = Hyoa_license.Getlicensesbybsquseridanddate(this.Session["hyuid"].ToString());

                    if (dtlicense.Rows.Count > 0)
                    {
                        this.rdsqyh.DataSource = dtlicense;
                        this.rdsqyh.DataTextField = "hy_sqrname";
                        this.rdsqyh.DataValueField = "hy_sqrid";
                        this.rdsqyh.DataBind();
                        this.rdsqyh.Items.Insert(0, new ListItem(this.Session["hyuname"].ToString(), this.Session["hyuid"].ToString()));
                        this.rdsqyh.SelectedIndex = 0;
                        this.table3.Visible = true;
                    }
                    else
                    {
                        this.Response.Redirect(this.lblurl.Text);
                    }

                }
                dt.Clear();
            }
            else
            {
                this.RegisterClientScriptBlock("scripterror", "<script language=javascript>alert('输入的用户名或者密码不正确!')</script>");
                return;
            }
    }
    protected void WebPageOpen()
    {
        Session["hyuid"] = "";
        Session["hyuname"] = "";
        Session["hydeptid"] = "";
        Session["hydeptname"] = "";
        Session["hydeptids_jz"] = "";
        Session["hydeptnames_jz"] = "";
        Session["hyisadmin"] = "";
        Session["hypost"] = "";
        Session["mystyle"] = "";
        Session["conntype"] = System.Configuration.ConfigurationManager.AppSettings["HYOA_CONNTYPE"].ToString();

        string ls_uid = "";
        string ls_pwd = "";
        string ls_key = "";
        string ls_url = "";

        if (this.Request.QueryString["uid"] != null)
        {
            ls_uid = this.Request.QueryString["uid"].ToString();
            ls_uid = ls_uid.ToLower();
        }

        if (this.Request.QueryString["pwd"] != null)
        {
            ls_pwd = this.Request.QueryString["pwd"].ToString();
            ls_pwd = ls_pwd.ToLower();
        }

        if (this.Request.QueryString["key"] != null)
            ls_key = this.Request.QueryString["key"].ToString();

        int pos = Request.RawUrl.IndexOf("&redirectto=");
        if (pos > 0)
            ls_url = this.Request.RawUrl.Substring(pos + 12);

        //if (ls_key != "cd04fa144ec48507")
        //    Response.Write("<script language=javascript>alert('非常抱歉,您的访问地址有误,请联系管理员!');self.close();</script>");

        String password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(ls_pwd, "MD5");
        HyoaClass.Hyoa_user Users = new HyoaClass.Hyoa_user();

        if (Users.Login(ls_uid, password))
        {
            DataTable dt = Users.Getuserallinfobyloginid(ls_uid);
            if (dt.Rows.Count > 0)
            {
                Session["hyuid"] = ls_uid;
                Session["hyuname"] = dt.Rows[0]["hy_username"].ToString();
                Session["hydeptid"] = dt.Rows[0]["hy_deptid"].ToString();
                Session["hydeptname"] = dt.Rows[0]["hy_deptname"].ToString();
                Session["hypost"] = dt.Rows[0]["hy_post"].ToString();

                //得到兼职
                DataTable dt_jz = Users.Getjzinfobyuserid(ls_uid);
                if (dt_jz.Rows.Count > 0)
                {
                    Session["hydeptids_jz"] = "";
                    Session["hydeptnames_jz"] = "";
                    for (int ii = 0; ii < dt_jz.Rows.Count; ii++)
                    {
                        if (Session["hydeptids_jz"] == "")
                        {
                            Session["hydeptids_jz"] = dt_jz.Rows[ii]["hy_deptid"].ToString();
                            Session["hydeptnames_jz"] = dt_jz.Rows[ii]["hy_deptname"].ToString();
                        }
                        else
                        {
                            Session["hydeptids_jz"] += "," + dt_jz.Rows[ii]["hy_deptid"].ToString();
                            Session["hydeptnames_jz"] += "," + dt_jz.Rows[ii]["hy_deptname"].ToString();
                        }

                    }
                }
                //得到风格
                HyoaClass.Hyoa_mystyle Hyoa_mystyle = new HyoaClass.Hyoa_mystyle();
                DataTable dt_mystyle = Hyoa_mystyle.Getstylebyuserid(ls_uid);
                if (dt_mystyle.Rows.Count > 0 && dt_mystyle.Rows[0]["hy_style"].ToString() != "")
                    Session["mystyle"] = dt_mystyle.Rows[0]["hy_style"].ToString();
                else
                    Session["mystyle"] = "/hyhtml/images/";

                this.Response.Redirect(ls_url);
            }
            dt.Clear();
        }
        else
        {
            this.Response.Redirect("../");
            return;
        }
    }
Exemple #6
0
    private void DataPlay()
    {
        //hy_json = "{\"success\":true,\"total\":\"60\",\"rows\":[{\"hy_mudelid\":\"111\",\"hy_mudelname\":\"1111\",\"hy_roleid\":\"111111\",\"hy_qqroleid\":\"111111\",\"hy_isenabled\":\"111111\"}]}";
        string hy_json = "";
        string ls_success = "true";    //调用方法成功
        string ls_flag = "0";   //登录失败
        string username = "";
        string password = "";
        username = this.Request.Form["txt_username"].ToString().ToLower();
        password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.Request.Form["txt_password"].ToString(), "MD5");
        HyoaClass.Hyoa_user Users = new HyoaClass.Hyoa_user();
        if (Users.Login(username, password))
        {
            DataTable dt = Users.Getuserallinfobyloginid(username);
            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["hy_isenabled"].ToString() == "否")
                {
                    //账号被禁用了
                }
                else
                {
                    Session["hyuid"] = username;
                    Session["hyuname"] = dt.Rows[0]["hy_username"].ToString();
                    Session["hydeptid"] = dt.Rows[0]["hy_deptid"].ToString();
                    Session["hydeptname"] = dt.Rows[0]["hy_deptname"].ToString();
                    Session["hypost"] = dt.Rows[0]["hy_post"].ToString();

                    //得到兼职
                    DataTable dt_jz = Users.Getjzinfobyuserid(username);
                    if (dt_jz.Rows.Count > 0)
                    {
                        Session["hydeptids_jz"] = "";
                        Session["hydeptnames_jz"] = "";
                        for (int i = 0; i < dt_jz.Rows.Count; i++)
                        {
                            if (Session["hydeptids_jz"] == "")
                            {
                                Session["hydeptids_jz"] = dt_jz.Rows[i]["hy_deptid"].ToString();
                                Session["hydeptnames_jz"] = dt_jz.Rows[i]["hy_deptname"].ToString();
                            }
                            else
                            {
                                Session["hydeptids_jz"] += "," + dt_jz.Rows[i]["hy_deptid"].ToString();
                                Session["hydeptnames_jz"] += "," + dt_jz.Rows[i]["hy_deptname"].ToString();
                            }

                        }
                    }
                    //得到风格
                    HyoaClass.Hyoa_mystyle Hyoa_mystyle = new HyoaClass.Hyoa_mystyle();
                    DataTable dt_mystyle = Hyoa_mystyle.Getstylebyuserid(username);
                    if (dt_mystyle.Rows.Count > 0 && dt_mystyle.Rows[0]["hy_style"].ToString() != "")
                        Session["mystyle"] = dt_mystyle.Rows[0]["hy_style"].ToString();
                    else
                        Session["mystyle"] = "/hyhtml/images/";

                    //Session["jqmtheme"] = this.Request.Form["ddlfengge"].ToString();
                    ls_flag = "1";
                }
            }
        }
        hy_json = "{\"success\":" + ls_success + ",\"flag\":\"" + ls_flag + "\"}";
        Response.Write(hy_json);
    }
Exemple #7
0
    /// <summary>
    /// 认证模式,密码是明码格式还是MD5格式
    /// pi_type  0:密码是明码格式 1:密码是MD5格式
    /// </summary>
    /// <param name="pi_type"></param>
    private void LoginCommand(string pi_type)
    {
        //if (Session["checkcode"].ToString().Equals(this.txt_checkcode.Value))
        String password = "";
        if (pi_type == "0")
        {
            password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.txt_password.Value, "MD5");
        }
        if (pi_type == "1")
        {
            password = this.txt_password.Value.ToUpper();
        }
        HyoaClass.Hyoa_user Users = new HyoaClass.Hyoa_user();

        if (Users.Login(this.txt_username.Value.ToLower(), password))
        {
            DataTable dt = Users.Getuserallinfobyloginid(this.txt_username.Value.ToLower());
            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["hy_isenabled"].ToString() == "否")
                {
                    //账号被禁用了
                    Response.Write("<script>alert('该账号已被禁用,请联系管理员!');</script>");
                }
                else
                {
                    Session["hyuid"] = this.txt_username.Value.ToLower();
                    Session["hyuname"] = dt.Rows[0]["hy_username"].ToString();
                    Session["hydeptid"] = dt.Rows[0]["hy_deptid"].ToString();
                    Session["hydeptname"] = dt.Rows[0]["hy_deptname"].ToString();
                    Session["hypost"] = dt.Rows[0]["hy_post"].ToString();

                    //得到兼职
                    DataTable dt_jz = Users.Getjzinfobyuserid(this.txt_username.Value.ToLower());
                    if (dt_jz.Rows.Count > 0)
                    {
                        Session["hydeptids_jz"] = "";
                        Session["hydeptnames_jz"] = "";
                        for (int i = 0; i < dt_jz.Rows.Count; i++)
                        {
                            if (Session["hydeptids_jz"] == "")
                            {
                                Session["hydeptids_jz"] = dt_jz.Rows[i]["hy_deptid"].ToString();
                                Session["hydeptnames_jz"] = dt_jz.Rows[i]["hy_deptname"].ToString();
                            }
                            else
                            {
                                Session["hydeptids_jz"] += "," + dt_jz.Rows[i]["hy_deptid"].ToString();
                                Session["hydeptnames_jz"] += "," + dt_jz.Rows[i]["hy_deptname"].ToString();
                            }

                        }
                    }
                    //得到风格
                    HyoaClass.Hyoa_mystyle Hyoa_mystyle = new HyoaClass.Hyoa_mystyle();
                    DataTable dt_mystyle = Hyoa_mystyle.Getstylebyuserid(this.txt_username.Value.ToLower());
                    if (dt_mystyle.Rows.Count > 0 && dt_mystyle.Rows[0]["hy_style"].ToString() != "")
                        Session["mystyle"] = dt_mystyle.Rows[0]["hy_style"].ToString();
                    else
                        Session["mystyle"] = "/hyhtml/images/";

                    HyoaClass.Hyoa_license Hyoa_license = new HyoaClass.Hyoa_license();
                    DataTable dtlicense = Hyoa_license.Getlicensesbybsquseridanddate(this.Session["hyuid"].ToString());

                    if (dtlicense.Rows.Count > 0)
                    {
                        ifshowopengwsq.Text = "1";
                    }
                    else
                    {
                        //////为用户创建一个票证,并将其放入cookie或者url中(具体看你怎么设置票证的保存方式)
                        ////FormsAuthentication.SetAuthCookie(this.txt_username.Value, true);
                        this.Response.Redirect(this.lblurl.Text);
                    }
                }
            }
            dt.Clear();
        }
        else
        {
            this.RegisterClientScriptBlock("scripterror", "<script language=javascript>alert('输入的用户名或者密码不正确!')</script>");
            return;
        }
    }