Last active
November 10, 2015 23:16
-
-
Save magkopian/f0724fa7faa629d302db to your computer and use it in GitHub Desktop.
A simple JavaScript clock that automaticly syncs time using AJAX - Server (Client: https://gist.github.com/magkopian/7a97ff98c3cafe14972e)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( isset($_GET['action']) && !empty($_GET['action']) && $_GET['action'] == 'get_time' ) { | |
header('Content-type: application/json'); | |
echo json_encode ( | |
array ( | |
'year' => date('Y'), | |
'month' => date('m'), | |
'day' => date('d'), | |
'hour' => date('h'), | |
'minute' => date('i'), | |
'second' => date('s') | |
) | |
); | |
} | |
else { | |
header('HTTP/1.1 404 Not Found'); | |
echo '<h1>404 Not Found</h1>'; | |
echo '<p>The page that you have requested could not be found.</p>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment