Bug tracker

This ticket has been moved to our new tracker. Open Ticket PHPBB3-8219 now.

Feature Request: Sort banned IPs (fix completed in vcs)

This is feature request and i don't know a better way to place it. It also covers the solution.

Nearly every day I must look after banned ips and it is hard to recognize, which ones are in my list and which ones belong to a range, because they are not sorted by numbers.

The solution would be quite simple by adding an ORDER BY snippet.

Edit the file includes/acp/acp_ban.php

Look for the sql cmd in line 155:

Code: Select all
$sql = 'SELECT *
   FROM ' . BANLIST_TABLE . '
   WHERE (ban_end >= ' . time() . "
         OR ban_end = 0)
      AND ban_ip <> ''";


Replace it with

Code: Select all
$sql = 'SELECT *
   FROM ' . BANLIST_TABLE . '
   WHERE (ban_end >= ' . time() . "
         OR ban_end = 0)
      AND ban_ip <> ''
   ORDER BY INET_ATON(ban_ip)";


Remarks: This will work with php versions >= 5.0

Comments / History

Posted by suitlocal on Mar 17th 2009, 20:02

does it work on the other databases phpbb supports though? postgresql mssql oracle etc?

also, ban_ip is a foreign key which i believe means it is also an indexed column. sorting indexed columns i believe is faster than non indexed columns and using an aggregate function in the sort by would effectively make it a non indexed sort i think?

Edited post #145935

Action performed by suitlocal on Mar 17th 2009, 20:08

Changed ticket severity from "Uncategorised/normal" to "Possibly invalid"

Action performed by bantu (3.0 Release Manager) on Mar 17th 2009, 20:45

Posted by bantu (3.0 Release Manager) on Mar 17th 2009, 20:45

I appreciate your snippet, but I doubt it will be added. I highly doubt it works for non-MySQL-DBMS and I'm also unsure if that function can deal with IPv6.

Edited post #145965

Action performed by bantu (3.0 Release Manager) on Mar 17th 2009, 20:51

Posted by Gorgonz on Mar 17th 2009, 22:31

it seems, that my scope was too narrow. MS-SQL knows about INET_NTOA but not INET_ATON. And with the other databases i'm not very familiar.

The other part with the index is a little more tricky of course. In order to have profit from this, you would usually design 4 octets in the table and use indices there. The existing index does not convert the string into cardinals and is useless therefore.

Anyway its ok to reject the solution. Just wanted to spread my own benefit (i have mysql ;-)) with others.

Changed ticket status from "New" to "Not a bug"

Action performed by bantu (3.0 Release Manager) on Mar 17th 2009, 22:50

Edited post #151975

Action performed by DavidIQ (MOD Team Leader) on Apr 21st 2009, 19:54

Edited post #151975

Action performed by DavidIQ (MOD Team Leader) on Apr 21st 2009, 19:54

Linked ticket with changeset: r10088

Action performed by TerraFrost (Former Team Member) on Sep 2nd 2009, 05:12

Changed ticket status from "Not a bug" to "Fix completed in SVN"

Action performed by TerraFrost (Former Team Member) on Sep 2nd 2009, 05:15

Assigned ticket to user "TerraFrost"

Action performed by TerraFrost (Former Team Member) on Sep 2nd 2009, 05:19

Changed ticket severity from "Possibly invalid" to "Uncategorised/normal"

Action performed by Schumi (QA Team) on Sep 2nd 2009, 14:34

Ticket details

Related SVN changesets