17 lines
461 B
PHP
17 lines
461 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
require __DIR__ . '/db.php';
|
|
|
|
$data = json_decode(file_get_contents("php://input"), true);
|
|
$uid = $data['uid'] ?? '';
|
|
$blocked = $data['blocked'] ?? -1;
|
|
|
|
if (!$uid || !in_array((int)$blocked, [0, 1], true)) {
|
|
http_response_code(400);
|
|
echo json_encode(["error" => "invalid"]);
|
|
exit;
|
|
}
|
|
|
|
$pdo->prepare("UPDATE contadores SET blocked=? WHERE uid=?")->execute([(int)$blocked, $uid]);
|
|
echo json_encode(["ok" => 1]);
|