Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        using (var a = new WebHelperClient())
        {
            if (!a.IsOpen())
            {
                Response.Write("服务器尚未开放!");
            }
            else
            {
                string name     = Request.Cookies["username"].GetSafeValue();
                string pass     = Request.Cookies["password"].GetSafeValue();
                int    inviteid = Request.Cookies["inviteid"].GetSafeValue().ConvertToInt(0);
                int    b        = 0;
                if (a.CheckUser(name, pass, inviteid))
                {
                    b = a.GetUserType(name);
                    if (b >= 2)
                    {
                        var x = Request.QueryString["ForceLoginUsername"].ToSafeString();
                        if (x != "" && a.ExistsUsername(x))
                        {
                            name = x;
                        }
                        var type = a.GetUserType(x);
                        if (b <= type)
                        {
                            Response.Write("对不起,你的权限不足");
                            return;
                        }
                    }
                    pass = Guid.NewGuid().ToString();
                    a.AddPlayer(name, pass);


                    string content = "user="******"&key=" + pass;

                    INVelocityEngine FileEngine = NVelocityEngineFactory.CreateNVelocityFileEngine(AppConfig.AppSettings["Path"], false);

                    IDictionary context = new Hashtable();
                    context.Add("Username", name);
                    context.Add("Content", content);
                    context.Add("Edition", "0");
                    context.Add("Rand", DateTime.Now.Ticks.ToString());
                    context.Add("UserType", b.ToString());
                    Response.Write(FileEngine.Process(context, "Game.vm"));
                }
                else
                {
                    Response.Cookies.Add(WebHelper.CreateCookie("username", "", DateTime.Now.AddYears(-1), "hqgddt.com"));
                    Response.Cookies.Add(WebHelper.CreateCookie("password", "", DateTime.Now.AddYears(-1), "hqgddt.com"));
                    Response.ReturnAndRedirect("用户名或密码错误!", "login");
                }
            }
        }
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.username = Request.Cookies["username"].GetSafeValue();
        this.password = Request.Cookies["password"].GetSafeValue();
        int inviteid = Request.Cookies["inviteid"].GetSafeValue().ConvertToInt(0);

        using (var a = new WebHelperClient())
        {
            if (a.CheckUser(username, password, inviteid))
            {
                this.usertype = a.GetUserType(username);
            }
        }

        if (this.usertype > 1)
        {
            var page = this.Request.QueryString["page"].ToSafeString();
            switch (page)
            {
            case "left":
                ProcessLeft();
                break;

            case "userlist":
                ProcessUserlist();
                break;

            case "version":
                ProcessVersion();
                break;

            case "top":
                ProcessTop();
                break;

            case "mail":
                ProcessMail();
                break;

            case "notice":
                ProcessNotice();
                break;

            case "status":
                ProcessStatus();
                break;

            default:
                ProcessIndex();
                break;
            }
        }
        else
        {
            Response.ReturnAndRedirect("你无权访问GM管理平台!", "../login");
        }
    }
Exemplo n.º 3
0
 private void ProcessKey()
 {
     using (var a = new WebHelperClient())
     {
         var name = Request.QueryString["UserName"].ToSafeString();
         if (name != "" && a.ExistsUsername(name))
         {
             var type = a.GetUserType(name);
             if (this.usertype <= type)
             {
                 Response.Write("对不起,你的权限不足");
                 return;
             }
             var pass = Guid.NewGuid().ToString();
             a.AddPlayer(name, pass);
             string content = "user="******"&key=" + pass;
             Response.Write(content);
         }
         else
         {
             Response.Write("错误");
         }
     }
 }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.username = Request.Cookies["username"].GetSafeValue();
        this.password = Request.Cookies["password"].GetSafeValue();
        int inviteid = Request.Cookies["inviteid"].GetSafeValue().ConvertToInt(0);

        using (var a = new WebHelperClient())
        {
            if (a.CheckUser(username, password, inviteid))
            {
                this.usertype = a.GetUserType(username);
            }
        }

        if (this.usertype > 1)
        {
            var page = this.Request.QueryString["method"].ToSafeString();
            switch (page)
            {
            case "charge":
                ProcessCharge();
                break;

            case "forbid":
                ProcessForbid();
                break;

            case "kitoff":
                ProcessKitoff();
                break;

            case "xml":
                ProcessXml();
                break;

            case "celeb":
                ProcessCeleb();
                break;

            case "notice":
                ProcessNotice();
                break;

            case "start":
                ProcessStart();
                break;

            case "stop":
                ProcessStop();
                break;

            case "reconnect":
                ProcessReconnect();
                break;

            case "loginkey":
                ProcessKey();
                break;

            default:
                break;
            }
        }
        else
        {
            Response.ReturnAndRedirect("你无权访问GM管理平台!", "../login");
        }
    }