<?php
require_once __DIR__ . '/../auth/verifica.php';
require_once __DIR__ . '/../config/conexao.php';

$id = isset($_GET['id']) ? $_GET['id'] : null;

if($id){

    $sql = "UPDATE pagamentos 
            SET status = IF(status='ativo','inativo','ativo') 
            WHERE id = ?";

    $stmt = $pdo->prepare($sql);
    $stmt->execute([$id]);
}

header("Location: pagamentos.php");
exit;