First attempt at making a client requestable server selection API

master
YandolsZX 3 years ago
parent de147b7984
commit 3de76ddb74
  1. 1
      index.php
  2. 9
      servertime.php

@ -12,6 +12,7 @@ $(document).ready(function() {
$.ajax({
type: 'POST',
url: 'servertime.php',
data: { server: ru-general },
timeout: 1000,
success: function(data) {
$("#timer").html(data);

@ -2,6 +2,14 @@
// Rocknarok Multiverse Time Clock
// Server Time API Module
// Process client requested data
$server = $_POST['server'];
echo $server; //debug test
// If client requested datetime for Rocknarok Universe (General Timezone).
if ($server='ru-general') {
// Set current datetime of Rocknarok Universe.
$rutime=date_create();
date_add($rutime,date_interval_create_from_date_string("-579 years"));
@ -13,5 +21,6 @@ date_add($rutime,date_interval_create_from_date_string("6 seconds"));
// Return current datetime to requester.
echo date_format($rutime,"Y/m/d H:i:s");
}
?>
Loading…
Cancel
Save