修訂 | 52 (tree) |
---|---|
時間 | 2022-10-26 06:02:36 |
作者 | ![]() |
the list of servers is sorted
@@ -3,7 +3,7 @@ | ||
3 | 3 | // |
4 | 4 | // OGUP servers list gophermap |
5 | 5 | // |
6 | -// Copyright (C) 2019-2021 Mateusz Viste | |
6 | +// Copyright (C) 2019-2022 Mateusz Viste | |
7 | 7 | // |
8 | 8 | |
9 | 9 |
@@ -32,6 +32,7 @@ | ||
32 | 32 | if (! $db) { |
33 | 33 | echo "3FAILED TO OPEN DB FILE\n"; |
34 | 34 | } else { |
35 | + $buff = array(); | |
35 | 36 | foreach ($db as $item) { |
36 | 37 | if ($item['port'] != 70) { |
37 | 38 | $nicename = $item['host'] . ':' . $item['port']; |
@@ -38,8 +39,12 @@ | ||
38 | 39 | } else { |
39 | 40 | $nicename = $item['host']; |
40 | 41 | } |
41 | - echo "1{$nicename}\t\t{$item['host']}\t{$item['port']}\n"; | |
42 | + //echo "1{$nicename}\t\t{$item['host']}\t{$item['port']}\n"; | |
43 | + $buff[] = "1{$nicename}\t\t{$item['host']}\t{$item['port']}"; | |
42 | 44 | } |
45 | + // sort the output buffer and... output it | |
46 | + sort($buff); | |
47 | + foreach ($buff as $line) echo $line . "\n"; | |
43 | 48 | fclose($fh); |
44 | 49 | } |
45 | 50 |