View file siwap.ru/AJAX/users/getAllUsers.php

File size: 635B
<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/system/App.php');
	
if ($sys->isAjax())
{
	$offset = !empty($_POST['offset']) ? (int) $_POST['offset'] : 0;
	$count = !empty($_POST['count']) ? (int) $_POST['count'] : 10;
	
	$arrUsers = $users->get($offset, $count);
	
	if (!empty($arrUsers) && is_array($arrUsers))
	{
		$json = [
			'success' => 1, 
			'response' => $arrUsers,
		];
	}
	else
	{
		$json = [
			'error' => 1, 
			'comment' => 'Еще никого нет',
		];
	}
}
else
{
	$json = [
		'error' => 1, 
		'comment' => '404 Bad Request'
	];
}
echo json_encode($json, JSON_UNESCAPED_UNICODE);