Просмотр файла sdark.mobi/api.php

Размер файла: 516B
<?php 


include __DIR__ . '/core/system.php';



function json_response(array $data)
{
	echo json_encode($data);
}

$method = (isset($_GET['method']) ? $_GET['method'] : null);

if (is_null($method)) {
	json_response([
			'success'	=>	false,
			'info'		=>	'Api method not found!'
		]);
}

switch ($method) {
	case 'online' : 
		return json_response([
				'status'	=>	true,
				'online'	=>	mysql_num_rows(mysql_query("SELECT `id` FROM `user` WHERE `online`>'".($_SERVER['REQUEST_TIME']-14400)."'"))
			]);
		break;
}