34 lines
678 B
PHP
34 lines
678 B
PHP
<?php
|
||
if($_SERVER['REQUEST_METHOD'] == 'GET') {
|
||
if(!isset($_REQUEST['login'])) {
|
||
$data = [
|
||
'error' => true,
|
||
'message' => 'Не передано поле login',
|
||
];
|
||
}
|
||
elseif(!$user = User::get($_REQUEST['login'])) {
|
||
$data = [
|
||
'error' => true,
|
||
'message' => 'Пользователь не существует',
|
||
];
|
||
}
|
||
else {
|
||
$data = [
|
||
'error' => false,
|
||
'data' => [
|
||
'id' => $user->id,
|
||
'login' => $user->login,
|
||
'info' => $user->info,
|
||
'reg_dt' => $user->reg_dt,
|
||
'online_dt' => $user->online_dt,
|
||
],
|
||
];
|
||
}
|
||
}
|
||
else {
|
||
$data = [
|
||
'error' => true,
|
||
'message' => 'Только метод GET',
|
||
];
|
||
}
|