Esempio n. 1
0
        public string ChkLoginWebApp(string _adminname, string _adminpass, int iExpires)
        {
            _adminname = _adminname.Replace("'", "");
            string str1 = MD5.Last64(_adminpass);

            using (DbOperHandler dbOperHandler = new ComData().Doh())
            {
                dbOperHandler.Reset();
                //str1 = "4f5d4bb4a98a1b7b589833d832ff21664e22c970afb770375bf750cd3b88658c"; //admin
                dbOperHandler.SqlCmd = string.Format("select top 1 Id,Point,IsEnable from N_User with(nolock) where username='******' and password='******' and isDel=0", (object)_adminname, (object)str1);
                DataTable dataTable = dbOperHandler.GetDataTable();
                if (dataTable.Rows.Count > 0)
                {
                    if (Convert.ToInt32(dataTable.Rows[0]["IsEnable"].ToString()) == 1)
                    {
                        return(this.JsonResult(0, "您的账户存在未知问题,请于客服联系!"));
                    }
                    if (Convert.ToInt32(dataTable.Rows[0]["IsEnable"].ToString()) == 2)
                    {
                        return(this.JsonResult(0, "对不起,您的网络不稳定,请重新登录!"));
                    }
                    string str2 = Guid.NewGuid().ToString().Replace("-", "");
                    Cookie.SetObj(this.site.CookiePrev + "WebApp", 1, new NameValueCollection()
                    {
                        {
                            "id",
                            dataTable.Rows[0]["Id"].ToString()
                        },
                        {
                            "name",
                            _adminname
                        },
                        {
                            "cookiess",
                            str2
                        },
                        {
                            "point",
                            dataTable.Rows[0]["Point"].ToString()
                        }
                    }, this.site.CookieDomain, this.site.CookiePath);
                    dbOperHandler.Reset();
                    dbOperHandler.ConditionExpress = "Id=@Id and IsEnable=0";
                    dbOperHandler.AddConditionParameter("@Id", (object)dataTable.Rows[0]["Id"].ToString());
                    dbOperHandler.AddFieldItem("LastTime", (object)DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    dbOperHandler.AddFieldItem("IP", (object)IPHelp.ClientIP);
                    dbOperHandler.AddFieldItem("sessionId", (object)str2);
                    dbOperHandler.AddFieldItem("IsOnline", (object)1);
                    dbOperHandler.AddFieldItem("Source", (object)0);
                    dbOperHandler.Update("N_User");
                    dbOperHandler.Dispose();
                    return(dataTable.Rows[0]["Id"].ToString());
                }
                dbOperHandler.Dispose();
                return(this.JsonResult(0, "会员账号或密码错误!"));
            }
        }
Esempio n. 2
0
        public string ChkLoginWebApp(string _adminname, string _adminpass, int iExpires)
        {
            _adminname = _adminname.Replace("'", "");
            string arg = MD5.Last64(_adminpass);
            string result;

            using (DbOperHandler dbOperHandler = new ComData().Doh())
            {
                dbOperHandler.Reset();
                dbOperHandler.SqlCmd = string.Format("select top 1 Id,Point,IsEnable from N_User with(nolock) where username='******' and password='******' and isDel=0", _adminname, arg);
                DataTable dataTable = dbOperHandler.GetDataTable();
                if (dataTable.Rows.Count > 0)
                {
                    if (Convert.ToInt32(dataTable.Rows[0]["IsEnable"].ToString()) == 1)
                    {
                        result = base.JsonResult(0, "您的账户存在未知问题,请于客服联系!");
                    }
                    else if (Convert.ToInt32(dataTable.Rows[0]["IsEnable"].ToString()) == 2)
                    {
                        result = base.JsonResult(0, "对不起,您的网络不稳定,请重新登录!");
                    }
                    else
                    {
                        string text = Guid.NewGuid().ToString().Replace("-", "");
                        NameValueCollection nameValueCollection = new NameValueCollection();
                        nameValueCollection.Add("id", dataTable.Rows[0]["Id"].ToString());
                        nameValueCollection.Add("name", _adminname);
                        nameValueCollection.Add("cookiess", text);
                        nameValueCollection.Add("point", dataTable.Rows[0]["Point"].ToString());
                        Cookie.SetObj(this.site.CookiePrev + "WebApp", 1, nameValueCollection, this.site.CookieDomain, this.site.CookiePath);
                        dbOperHandler.Reset();
                        dbOperHandler.ConditionExpress = "Id=@Id and IsEnable=0";
                        dbOperHandler.AddConditionParameter("@Id", dataTable.Rows[0]["Id"].ToString());
                        dbOperHandler.AddFieldItem("LastTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                        dbOperHandler.AddFieldItem("IP", IPHelp.ClientIP);
                        dbOperHandler.AddFieldItem("sessionId", text);
                        dbOperHandler.AddFieldItem("IsOnline", 1);
                        dbOperHandler.AddFieldItem("Source", 0);
                        dbOperHandler.Update("N_User");
                        dbOperHandler.Dispose();
                        result = dataTable.Rows[0]["Id"].ToString();
                    }
                }
                else
                {
                    dbOperHandler.Dispose();
                    result = base.JsonResult(0, "会员账号或密码错误!");
                }
            }
            return(result);
        }
Esempio n. 3
0
 public string ChkAutoLoginWebApp(string _Id, string _sessionId)
 {
     using (DbOperHandler dbOperHandler = new ComData().Doh())
     {
         dbOperHandler.Reset();
         dbOperHandler.SqlCmd = string.Format("select top 1 UserName,Point,sessionId from N_User with(nolock) where Id={0}", _Id);
         DataTable dataTable = dbOperHandler.GetDataTable();
         if (dataTable.Rows.Count > 0)
         {
             if (!string.IsNullOrEmpty(string.Concat(dataTable.Rows[0]["sessionId"])))
             {
                 NameValueCollection nameValueCollection = new NameValueCollection();
                 nameValueCollection.Add("id", _Id);
                 nameValueCollection.Add("name", dataTable.Rows[0]["UserName"].ToString());
                 nameValueCollection.Add("cookiess", dataTable.Rows[0]["sessionId"].ToString());
                 nameValueCollection.Add("point", dataTable.Rows[0]["Point"].ToString());
                 Cookie.SetObj(this.site.CookiePrev + "WebApp", 1, nameValueCollection, this.site.CookieDomain, this.site.CookiePath);
             }
             else
             {
                 string text = Guid.NewGuid().ToString().Replace("-", "");
                 dbOperHandler.Reset();
                 dbOperHandler.ConditionExpress = "Id=@Id";
                 dbOperHandler.AddConditionParameter("@Id", _Id);
                 dbOperHandler.AddFieldItem("sessionId", text);
                 dbOperHandler.Update("N_User");
                 dbOperHandler.Dispose();
                 NameValueCollection nameValueCollection2 = new NameValueCollection();
                 nameValueCollection2.Add("id", _Id);
                 nameValueCollection2.Add("name", dataTable.Rows[0]["UserName"].ToString());
                 nameValueCollection2.Add("cookiess", text);
                 nameValueCollection2.Add("point", dataTable.Rows[0]["Point"].ToString());
                 Cookie.SetObj(this.site.CookiePrev + "WebApp", 1, nameValueCollection2, this.site.CookieDomain, this.site.CookiePath);
             }
         }
     }
     return(_Id);
 }
Esempio n. 4
0
 public string ChkAutoLoginWebApp(string _Id, string _sessionId, int iExpires)
 {
     using (DbOperHandler dbOperHandler = new ComData().Doh())
     {
         dbOperHandler.Reset();
         dbOperHandler.SqlCmd = string.Format("select top 1 UserName,Point,sessionId from N_User with(nolock) where Id={0}", (object)_Id);
         DataTable dataTable = dbOperHandler.GetDataTable();
         if (dataTable.Rows.Count > 0)
         {
             if (!string.IsNullOrEmpty(string.Concat(dataTable.Rows[0]["sessionId"])))
             {
                 Cookie.SetObj(this.site.CookiePrev + "WebApp", 1, new NameValueCollection()
                 {
                     {
                         "id",
                         _Id
                     },
                     {
                         "name",
                         dataTable.Rows[0]["UserName"].ToString()
                     },
                     {
                         "cookiess",
                         dataTable.Rows[0]["sessionId"].ToString()
                     },
                     {
                         "point",
                         dataTable.Rows[0]["Point"].ToString()
                     }
                 }, "www.youle1288.com;youle1288.com;www.youle2888.com;youle2888.com,feifan1188.com,www.feifan1188.com", this.site.CookiePath);
             }
             else
             {
                 string str = Guid.NewGuid().ToString().Replace("-", "");
                 dbOperHandler.Reset();
                 dbOperHandler.ConditionExpress = "Id=@Id";
                 dbOperHandler.AddConditionParameter("@Id", (object)_Id);
                 dbOperHandler.AddFieldItem("sessionId", (object)str);
                 dbOperHandler.Update("N_User");
                 dbOperHandler.Dispose();
                 Cookie.SetObj(this.site.CookiePrev + "WebApp", 1, new NameValueCollection()
                 {
                     {
                         "id",
                         _Id
                     },
                     {
                         "name",
                         dataTable.Rows[0]["UserName"].ToString()
                     },
                     {
                         "cookiess",
                         str
                     },
                     {
                         "point",
                         dataTable.Rows[0]["Point"].ToString()
                     }
                 }, "www.youle1288.com;youle1288.com;www.youle2888.com;youle2888.com,feifan1188.com,www.feifan1188.com", this.site.CookiePath);
             }
         }
         return(_Id);
     }
 }