From df3209e099e7d781e60a574a263a9f8e33f10ad8 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 6 Jun 2019 16:13:37 +0200 Subject: pool.php new for pool.mirror.archlinux32.org --- pool.php | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 pool.php diff --git a/pool.php b/pool.php new file mode 100644 index 0000000..19c0b87 --- /dev/null +++ b/pool.php @@ -0,0 +1,44 @@ + UNIX_TIMESTAMP(NOW())-' . $cutoff . + ' AND `mirror_statuses`.`protocol` = "' . $protocol . '"' . + ' GROUP BY `mirror_statuses`.`url`' . + ' ORDER BY SHA2(' . + 'CONCAT(' . + '`mirror_statuses`.`url`,' . + 'NOW(),' . + '"' . base64_encode( + $_SERVER['REMOTE_PORT'] . ' ' . + $_SERVER['REMOTE_ADDR'] + ) . '"' . + '),' . + '256' . + ')' . + ' LIMIT 1' +); + +$mirror = $result -> fetch_assoc(); +if (! array_key_exists('url',$mirror)) + die_500('no mirror reachable'); + +$request_uri = $_SERVER['REQUEST_URI']; + +if (substr($request_uri, 0, 1) == '/') + $request_uri = substr($request_uri, 1); + +redirect_temporarily($mirror['url'] . $request_uri); -- cgit v1.2.3