<?php
require_once('session.php');

// Pastikan koneksi HTTPS
if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] !== 'on') {
    header("HTTP/1.1 403 Forbidden");
    echo "Access forbidden. Use HTTPS.";
    exit();
}

// Ambil parameter dari URL
$id = $_GET['postID'];
$status = $_GET['status'];

// Validasi status hanya boleh 1, 2, 3, atau 4
if (!in_array($status, [1, 2, 3, 4])) {
    header("HTTP/1.1 400 Bad Request");
    echo "Invalid status.";
    exit();
}

// Update status di database
$query = mysqli_query($conn, "UPDATE `tb_user` SET pinTrx = '$status' WHERE cuid = '$id'") or die(mysqli_error());

    header('location:../up-member/');
?>