Another exploit found, thanks to AWA:
Find:
Code:
internal void ChangeName()
Replace that void with:
Code:
internal void ChangeName()
{
string text = this.Request.PopFixedString();
string username = this.Session.GetHabbo().Username;
checked
{
using (IQueryAdapter queryreactor = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
{
queryreactor.setQuery("SELECT username FROM users WHERE username=@name LIMIT 1");
queryreactor.addParameter("name", text);
string @String = queryreactor.getString();
if (string.IsNullOrWhiteSpace @String) || username.ToLower() == text.ToLower())
{
queryreactor.setQuery("UPDATE rooms SET owner = @newowner WHERE owner = @oldowner");
queryreactor.addParameter("newowner", text);
queryreactor.addParameter("oldowner", Session.GetHabbo().Username);
queryreactor.runQuery();
queryreactor.setQuery("UPDATE users SET username = @newname, last_name_change = @timestamp WHERE id = @userid");
queryreactor.addParameter("newname", text);
queryreactor.addParameter("timestamp", MercuryEnvironment.GetUnixTimestamp() + 43200);
queryreactor.addParameter("userid", Session.GetHabbo().Username);
queryreactor.runQuery();
this.Session.GetHabbo().LastChange = MercuryEnvironment.GetUnixTimestamp() + 43200;
this.Session.GetHabbo().Username = text;
this.Response.Init(Outgoing.UpdateUserNameMessageComposer);
this.Response.AppendInt32(0);
this.Response.AppendString(text);
this.Response.AppendInt32(0);
this.SendResponse();
this.Response.Init(Outgoing.UpdateUserDataMessageComposer);
this.Response.AppendInt32(-1);
this.Response.AppendString(this.Session.GetHabbo().Look);
this.Response.AppendString(this.Session.GetHabbo().Gender.ToLower());
this.Response.AppendString(this.Session.GetHabbo().Motto);
this.Response.AppendInt32(this.Session.GetHabbo().AchievementPoints);
this.SendResponse();
this.Session.GetHabbo().CurrentRoom.GetRoomUserManager().UpdateUser(username, text);
if (this.Session.GetHabbo().CurrentRoom != null)
{
this.Response.Init(Outgoing.UserUpdateNameInRoomMessageComposer);
this.Response.AppendUInt(this.Session.GetHabbo().Id);
this.Response.AppendUInt(this.Session.GetHabbo().CurrentRoom.RoomId);
this.Response.AppendString(text);
}
foreach (RoomData current in this.Session.GetHabbo().UsersRooms)
{
current.Owner = text;
current.SerializeRoomData(this.Response, false, this.Session, true);
Room room = MercuryEnvironment.GetGame().GetRoomManager().GetRoom(current.Id);
if (room != null)
{
room.Owner = text;
}
}
foreach (MessengerBuddy current2 in this.Session.GetHabbo().GetMessenger().friends.Values)
{
if (current2.client != null)
{
foreach (MessengerBuddy current3 in current2.client.GetHabbo().GetMessenger().friends.Values)
{
if (current3.mUsername == username)
{
current3.mUsername = text;
current3.Serialize(this.Response, current2.client);
}
}
}
}
}
}
}
}