Esempio n. 1
0
 public ActionResult IpAddresses(string ipAddress = null)
 {
     var model = new PlayerInfoModel();
     if (ipAddress != null)
     {
         using (var db = new DBConnection())
         {
             model.IpAddresses = db.EvaluateTable("select * from account_login where ipaddress = '{0}' order by datetime desc limit 100", DBConnection.AddSlashes(ipAddress));
         }
     }
     return View(model);
 }
Esempio n. 2
0
        public ActionResult PlayerInfo(int id)
        {
            if (id <= 0)
                return HttpNotFound();

            var model = new PlayerInfoModel();

            using (var db = new DBConnection())
            {
                model.Account = Account.Load(db.EvaluateRow("select * from account where id = {0}", id));

                if (model.Account == null)
                    return HttpNotFound();

                if (LoggedIn && Account.Id == id) // use freshest account record
                    Account = model.Account;

                if (IsSet("ShowLoginHistory"))
                    model.IpAddresses = db.EvaluateTable("select * from account_login where account_id = " + id + " order by datetime desc limit 100");

                if (IsSet("KillAccount") && Account.IsAdmin)
                {
                    db.Execute("update account set disabled_by = " + Account.Id + " where id=" + id);
                    ViewBag.ErrorMessage = "Account Disabled";
                }

                if (id > 1)
                    model.Games = GameServer.GetPlayerGames(id, IsSet("AllGames"));
                else
                    model.Games = new List<Game>();
            }

            return View("PlayerInfo", model);
        }