Exemple #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["uid"].ToString() == "")
     {
         this.Response.Redirect("login.aspx?url=" + this.Request.RawUrl.ToString());
     }
     else
     {
         HyUser HyUser = new HyUser();
         DataTable dt = HyUser.Getuserbyuserid(this.Session["uid"].ToString());
         if (dt.Rows.Count > 0)
         {
             lbluserinfo.Text = dt.Rows[0]["hy_username"].ToString();
         }
         webname.Text = "";
         weburl.Text = "";
         webcompany.Text = "宁波合益信息科技有限公司";
         dbname.Text = "";
         versions.Text = "";
         //读取登录信息
         //HySyslogs HySyslogs = new HySyslogs();
         //DataTable dt_log = HySyslogs.Getlogs();
         //if (dt_log.Rows.Count > 0)
         //{
         //    litIP.Text = dt_log.Rows[0]["hy_oppip"].ToString();
         //}
         //if (dt_log.Rows.Count > 1)
         //{
         //    litBackIP.Text = dt_log.Rows[1]["hy_oppip"].ToString();
         //    litBackTime.Text = dt_log.Rows[1]["hy_createtime"].ToString();
         //}
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         if (this.Request.QueryString["userid"] != null)
         {
             this.txtUid.Text = this.Request.QueryString["userid"].ToString();
             HyUser HyUser = new HyUser();
             DataTable dt = HyUser.Getuserbyuserid(this.txtUid.Text);
             if (dt.Rows.Count > 0)
             {
                 this.txtUname.Text = dt.Rows[0]["hy_username"].ToString();
             }
         }
     }
 }
Exemple #3
0
 protected void btn_submit_Click(object sender, EventArgs e)
 {
     String pwd = FormsAuthentication.HashPasswordForStoringInConfigFile(this.pwd.Text, "MD5");
     HyUser HyUser = new HyUser();
     HyCommon HyCommon = new HyCommon();
     if (Session["SESSION_CODE"].ToString().ToLower().Equals(this.txtCode.Text.ToLower()))
     {
         if (HyUser.Login(this.user.Text, pwd))
         {
             DataTable dt = HyUser.Getuserbyuserid(this.user.Text);
             if (dt.Rows.Count > 0)
             {
                 Session["uid"] = dt.Rows[0]["hy_userid"].ToString();
                 Session["uname"] = dt.Rows[0]["hy_username"].ToString();
                 Session["deptid"] = dt.Rows[0]["hy_deptid"].ToString();
             }
             //写系统日志
             string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
             if (userip == null || userip == "")
             {
                 userip = Request.ServerVariables["REMOTE_ADDR"];
             }
             //写系统日志
             HyCommon.WriteLog("登录", "系统登录", Session["uid"].ToString(), Session["uname"].ToString());
             //跳转到首页
             Response.Redirect(lblurl.Text);
         }
         else
         {
             Response.Write("<script>alert('输入的用户名或者密码不正确!');window.location.href = window.location.href;</script>");
         }
     }
     else
     {
         Response.Write("<script>alert('输入的验证码不正确!');window.location.href = window.location.href;</script>");
     }
 }