'You do not have permission to perform this action.']); exit; } $tab_id = $_POST['tab_id'] ?? null; if (!$tab_id) { http_response_code(400); // Bad Request echo json_encode(['error' => 'Tab ID is required.']); exit; } try { // Set the token to NULL in the database $stmt = $pdo->prepare("UPDATE tabs SET login_token = NULL WHERE id = ?"); $stmt->execute([$tab_id]); echo json_encode(['success' => true]); } catch (Exception $e) { http_response_code(500); // Internal Server Error echo json_encode(['error' => 'Failed to clear token: ' . $e->getMessage()]); }