Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Releases
PlusEMU Query fix. (APPLY THIS ASAP)
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Sledmore" data-source="post: 250453" data-attributes="member: 591"><p>Hey.</p><p></p><p>So I check Habboons log files daily to see if there is anything I can fix and to improve the emulator, well today I'd found a user had accidentally caused an error that lead me on to find this. Well with further inspection I could drop any tables such (just like the old navigator issue, with the search query not being sanitized).</p><p></p><p>So, here are two simple fixes. (<strong>both in GroupManager.cs</strong>)</p><p></p><p>Replace both methods;</p><ul> <li data-xf-list-type="ul">GetGroupUsersByString<br /> </li> <li data-xf-list-type="ul">GetGroupRequestsByString</li> </ul><p>With:</p><p>[PHP]</p><p> internal List<GroupUser> GetGroupUsersByString(Group Group, String SearchVal, uint Req)</p><p> {</p><p> var Users = new List<GroupUser>();</p><p> if (string.IsNullOrWhiteSpace(SearchVal))</p><p> {</p><p> if (Req == 0)</p><p> foreach (GroupUser U in Group.Members.Values)</p><p> Users.Add(U);</p><p> else</p><p> foreach (GroupUser U in Group.Admins.Values)</p><p> Users.Add(U);</p><p> }</p><p> else</p><p> {</p><p> using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().getQueryreactor())</p><p> {</p><p> dbClient.setQuery("SELECT id FROM users WHERE username LIKE @query");</p><p> dbClient.addParameter("query", "%" + SearchVal + "%");</p><p> DataTable Table = dbClient.getTable();</p><p> if (Table == null)</p><p> {</p><p> if (Req == 0)</p><p> foreach (GroupUser U in Group.Members.Values)</p><p> Users.Add(U);</p><p> else</p><p> foreach (GroupUser U in Group.Admins.Values)</p><p> Users.Add(U);</p><p> }</p><p> else</p><p> {</p><p> foreach (DataRow Row in Table.Rows)</p><p> {</p><p> if (Group.Members.ContainsKey((uint)Row[0]))</p><p> Users.Add(Group.Members[(uint)Row[0]]);</p><p> }</p><p> }</p><p> }</p><p> }</p><p> return Users;</p><p> }</p><p></p><p> internal List<uint> GetGroupRequestsByString(Group Group, String SearchVal, uint Req)</p><p> {</p><p> if (string.IsNullOrWhiteSpace(SearchVal))</p><p> return Group.Requests;</p><p> var Users = new List<uint>();</p><p> using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().getQueryreactor())</p><p> {</p><p> dbClient.setQuery("SELECT id FROM users WHERE username LIKE @query");</p><p> dbClient.addParameter("query", "%" + SearchVal + "%");</p><p> DataTable Table = dbClient.getTable();</p><p> if (Table != null)</p><p> {</p><p> foreach (DataRow Row in Table.Rows)</p><p> {</p><p> if (Group.Requests.Contains((uint)Row[0]))</p><p> Users.Add((uint)Row[0]);</p><p> }</p><p> }</p><p> }</p><p> return Users;</p><p> }</p><p></p><p>[/PHP]</p><p></p><p>You're welcome.</p></blockquote><p></p>
[QUOTE="Sledmore, post: 250453, member: 591"] Hey. So I check Habboons log files daily to see if there is anything I can fix and to improve the emulator, well today I'd found a user had accidentally caused an error that lead me on to find this. Well with further inspection I could drop any tables such (just like the old navigator issue, with the search query not being sanitized). So, here are two simple fixes. ([B]both in GroupManager.cs[/B]) Replace both methods; [LIST] [*]GetGroupUsersByString [*]GetGroupRequestsByString [/LIST] With: [PHP] internal List<GroupUser> GetGroupUsersByString(Group Group, String SearchVal, uint Req) { var Users = new List<GroupUser>(); if (string.IsNullOrWhiteSpace(SearchVal)) { if (Req == 0) foreach (GroupUser U in Group.Members.Values) Users.Add(U); else foreach (GroupUser U in Group.Admins.Values) Users.Add(U); } else { using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("SELECT id FROM users WHERE username LIKE @query"); dbClient.addParameter("query", "%" + SearchVal + "%"); DataTable Table = dbClient.getTable(); if (Table == null) { if (Req == 0) foreach (GroupUser U in Group.Members.Values) Users.Add(U); else foreach (GroupUser U in Group.Admins.Values) Users.Add(U); } else { foreach (DataRow Row in Table.Rows) { if (Group.Members.ContainsKey((uint)Row[0])) Users.Add(Group.Members[(uint)Row[0]]); } } } } return Users; } internal List<uint> GetGroupRequestsByString(Group Group, String SearchVal, uint Req) { if (string.IsNullOrWhiteSpace(SearchVal)) return Group.Requests; var Users = new List<uint>(); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("SELECT id FROM users WHERE username LIKE @query"); dbClient.addParameter("query", "%" + SearchVal + "%"); DataTable Table = dbClient.getTable(); if (Table != null) { foreach (DataRow Row in Table.Rows) { if (Group.Requests.Contains((uint)Row[0])) Users.Add((uint)Row[0]); } } } return Users; } [/PHP] You're welcome. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
PlusEMU Query fix. (APPLY THIS ASAP)
Top