<?php
require 'db.php';

$mobile = $_POST['mobile'] ?? '';
$status = $_POST['device_status'] ?? '';

if ($mobile != '' && $status != '') {
    $stmt = $pdo->prepare("UPDATE users SET device_status = ? WHERE mobile = ?");
    $ok = $stmt->execute([$status, $mobile]);
    echo json_encode(['status' => $ok]);
} else {
    echo json_encode(['status' => false, 'message' => 'Invalid input']);
}
