PHP game server for TerranQuest. https://terranquest.net

cluster.php 516B

1234567891011121314151617181920
  1. <?php
  2. /*
  3. * Send the client a list of servers that share the database. The client should
  4. * pick one at random and use it for the entire session.
  5. */
  6. require 'required.php';
  7. $servers = [];
  8. if (is_empty(SERVER_URLS) || SERVER_URLS == []) {
  9. $servers[] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
  10. } else {
  11. foreach (SERVER_URLS as $server) {
  12. $servers[] = $server;
  13. }
  14. }
  15. die(json_encode($servers));