<?php

if (!isset($_POST['activate'])) {
    $con = mysqli_connect("localhost", "sprizbgf_kev", "DXQDp1{X5HyN", "sprizbgf_kev");
    
    
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// Get user ID from query string
if (isset($_GET['id'])) {
    $id = intval($_GET['id']);
    
    // Update the user to active
    $sql = "UPDATE users SET is_active = 1 WHERE id = $id";
    
    if ($conn->query($sql) === TRUE) {
        echo "User  activated successfully.";
    } else {
        echo "Error activating user: " . $conn->error;
    }
} else {
    echo "No user ID provided.";
}

$conn->close();

/////////



if (!isset($_POST['deactivate'])) {
    $con = mysqli_connect("localhost", "sprizbgf_kev", "DXQDp1{X5HyN", "sprizbgf_kev");
    
    $$conn = new mysqli(localhost, sprizbgf_kev, DXQDp1{X5HyN, sprizbgf_kev);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// Get user ID from query string
if (isset($_GET['id'])) {
    $id = intval($_GET['id']);
    
    // Update the user to inactive
    $sql = "UPDATE users SET is_active = 0 WHERE id = $id";
    
    if ($conn->query($sql) === TRUE) {
        echo "User  deactivated successfully.";
    } else {
        echo "Error deactivating user: " . $conn->error;
    }
} else {
    echo "No user ID provided.";
}

$conn->close();



?>