コード例 #1
0
ファイル: HtmlUser.cs プロジェクト: withercn/advali
 public static void LoginUser(string username, string password, object code)
 {
     ((Page)HttpContext.Current.Handler).ClientScript.RegisterStartupScript(((Page)HttpContext.Current.Handler).GetType(), "forgetscript", "start=0;objid='inputid';", true);
     if (object.Equals(code, HttpContext.Current.Session["code"]))
     {
         int  userid = Consult.LoginUser(username, password);
         User user   = Consult.GetUser(userid);
         if (user.GroupId < 8 && !Global.config.AllowLogin)
         {
             MsgBox.Alert("系统目前不允许用户登陆");
             return;
         }
         if (userid > 0)
         {
             AdvAliCookie.WriteUserCookie(clsdes.Encrypt(userid.ToString()), Global.__Domain, DateTime.Now.AddDays(7));
             MsgBox.AlertA(string.Format("用户 {0} 登陆成功!", username), "location.href=\"" + Global.__WebSiteUrl + "index.aspx\";");
         }
         else
         {
             MsgBox.Alert(string.Format("用户 {0} 密码错误!", username));
         }
     }
     else
     {
         MsgBox.Alert("验证码错误!");
     }
 }
コード例 #2
0
ファイル: HtmlUser.cs プロジェクト: withercn/advali
 public static bool IsOperatorLogged()
 {
     if (!string.IsNullOrEmpty(AdvAliCookie.GetCookieMemberId()))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #3
0
ファイル: HtmlUser.cs プロジェクト: withercn/advali
        public static int GetLoggedMemberId()
        {
            string memberid = AdvAliCookie.GetCookieMemberId();

            if (string.IsNullOrEmpty(memberid))
            {
                return(0);
            }
            string userid = clsdes.Decrypt(memberid);

            if (string.IsNullOrEmpty(userid))
            {
                return(0);
            }
            else
            {
                return(int.Parse(userid));
            }
        }
コード例 #4
0
ファイル: HtmlUser.cs プロジェクト: withercn/advali
 public static void LogoutUser()
 {
     AdvAliCookie.RemoveCookie();
     MsgBox.ScriptAlert("Logout", "<p>用户退出登陆成功!</p>", AdvAli.Config.Global.config.WebSiteUrl + "/login.aspx", "top");
 }