Implement other client requestable servers into the API

master
YandolsZX 3 years ago
parent be98743763
commit 350b9893c3
  1. 57
      servertime.php

@ -8,21 +8,52 @@ $data = $_POST['server'];
// If client requested datetime for Rocknarok Universe (General Timezone). // If client requested datetime for Rocknarok Universe (General Timezone).
if ($data == 'ru_general') { if ($data == 'ru_general') {
// Set current datetime of Rocknarok Universe. // Set current datetime of Rocknarok Universe.
$rutime=date_create(); $rutime=date_create();
date_add($rutime,date_interval_create_from_date_string("-579 years")); date_add($rutime,date_interval_create_from_date_string("-579 years"));
date_add($rutime,date_interval_create_from_date_string("-6 months")); date_add($rutime,date_interval_create_from_date_string("-6 months"));
date_add($rutime,date_interval_create_from_date_string("12 days")); date_add($rutime,date_interval_create_from_date_string("12 days"));
date_add($rutime,date_interval_create_from_date_string("2 hours")); date_add($rutime,date_interval_create_from_date_string("2 hours"));
date_add($rutime,date_interval_create_from_date_string("17 minutes")); date_add($rutime,date_interval_create_from_date_string("17 minutes"));
date_add($rutime,date_interval_create_from_date_string("6 seconds")); date_add($rutime,date_interval_create_from_date_string("6 seconds"));
// Return current datetime to requester. // Return current datetime to requester.
echo date_format($rutime,"Y/m/d H:i:s"); echo date_format($rutime,"Y/m/d H:i:s");
exit(); exit();
}
// If client requested datetime for St. Sky Universe (General Timezone).
if ($data == 'ssu_general') {
// Set current datetime of St. Sky Universe.
$ssutime=date_create();
date_add($ssutime,date_interval_create_from_date_string("1 days"));
date_add($ssutime,date_interval_create_from_date_string("-1 hours"));
// Return current datetime to requester.
echo date_format($ssutime,"Y/m/d H:i:s");
exit();
}
// If client requested datetime for Kocharion Universe (General Timezone).
if ($data == 'ku_general') {
// Set current datetime of Kocharion Universe.
$kutime=date_create();
date_add($kutime,date_interval_create_from_date_string("-1691 years"));
date_add($kutime,date_interval_create_from_date_string("-8 months"));
date_add($kutime,date_interval_create_from_date_string("8 days"));
date_add($kutime,date_interval_create_from_date_string("6 hours"));
date_add($kutime,date_interval_create_from_date_string("1 minutes"));
date_add($kutime,date_interval_create_from_date_string("14 seconds"));
// Return current datetime to requester.
echo date_format($kutime,"Y/m/d H:i:s");
exit();
} }
// If client requested a server not on the list or is request is malformed. // If client requested a server not on the list or is request is malformed.
echo "Something went wrong."; http_response_code(400);
echo "Something went wrong with your request. Valid servers to request: ru_general, ssu_general, ku_general.";
exit(); exit();
?> ?>
Loading…
Cancel
Save