<?php
session_start();
$id=$_GET['id'];
$name=$_GET['name'];
include '../includes/connection.php';


$sql = mysqli_query($con,"UPDATE users set suspend=0 where id='$id'");

if ($sql === TRUE) {
	    $id_user=$_SESSION['id'];
		  $activity="Suspended User ".$name;
		  $log_sql=mysqli_query($conn,"INSERT INTO logs(user_id, activity) VALUES 
('$id_user','$activity')");

if ($log_sql) {
    ?>

<meta http-equiv="refresh" content="0;URL='users.php'" />
   <?php
} else {
    echo "Error: Failed to add log <br>" . mysqli_error($conn);
}
   
} else {
    echo "Error updating record: " . $conn->error;
}

$conn->close();
?>