blob: af8cc2ff17477171b3aa5eab0ee423d0f9a01b88 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/../config.php';
function json_response(mixed $data, string|null $message, int $code = 200)
{
http_response_code($code);
header('Content-Type: application/json');
echo json_encode([
'status_code' => $code,
'message' => $message,
'data' => $data
]);
}
function generate_random_char_sequence(array $chars, int $length): string
{
$o = "";
for ($i = 0; $i < $length; $i++) {
$o .= $chars[random_int(0, count($chars) - 1)];
}
return $o;
}
|