<?php
/**
 * Müşteri Durum Toggle (Aktif/Pasif)
 * Konum: /magaza/admin/musteri/durum_degistir.php
 */
require_once '../../includes/db.php';
require_once '../../includes/functions.php';
adminCheck();

if (isset($_GET['id']) && is_numeric($_GET['id'])) {
    $id = (int)$_GET['id'];
    
    // Mevcut durumu al ve tersine çevir
    $stmt = $db->prepare("UPDATE users SET status = 1 - status WHERE id = ? AND role = 'customer'");
    $stmt->execute([$id]);
}

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