<?php
// Connect to the database
define('DB_SERVER', 'localhost');
define('DB_USERNAME', '');
define('DB_PASSWORD', '!');
define('DB_NAME', '');
$dm = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
// Get online status of each admin
$sql = "SELECT id, lastseen, online FROM `dm_admins`";
$result = mysqli_query($dm, $sql);
$data = array();
while ($row = mysqli_fetch_array($result)) {
$data[] = array(
'id' => $row['id'],
'lastseen' => strtotime($row['lastseen']),
'online' => (bool) $row['online']
);
}
// Return online status data as JSON
header('Content-Type: application/json');
echo json_encode($data);
exit;
?>
Editor is loading...