summaryrefslogtreecommitdiff
path: root/pool.php
diff options
context:
space:
mode:
Diffstat (limited to 'pool.php')
-rw-r--r--pool.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/pool.php b/pool.php
index 16da13a..ff26e5b 100644
--- a/pool.php
+++ b/pool.php
@@ -12,6 +12,12 @@ if (array_key_exists('HTTPS',$_SERVER) && ($_SERVER['HTTPS']=='on'))
else
$protocol = 'http';
+$ipv_filter = '';
+if (filter_var($_SERVER['SERVER_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4))
+ $ipv_filter .= ' AND `mirror_statuses`.`ipv4`';
+if (filter_var($_SERVER['SERVER_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
+ $ipv_filter .= ' AND `mirror_statuses`.`ipv6`';
+
$result = mysql_run_query(
'SELECT `mirror_statuses`.`url` FROM `mirror_statuses`' .
' WHERE `mirror_statuses`.`active`' .
@@ -19,6 +25,7 @@ $result = mysql_run_query(
' AND `mirror_statuses`.`start` > UNIX_TIMESTAMP(NOW())-' . $cutoff .
' AND `mirror_statuses`.`protocol` = "' . $protocol . '"' .
' AND `mirror_statuses`.`url` NOT LIKE "%.oss/%"' .
+ $ipv_filter .
' GROUP BY `mirror_statuses`.`url`' .
' ORDER BY SHA2(' .
'CONCAT(' .