Viewing File: /home/quiczmwg/lightspringdigitals.com/admin/dist/createnft-controller.php

<?php
include_once ("../_db.php");
// session_start();

if (isset($_GET['id']) && isset($_GET['status']) && $_GET['status'] == 'confirm') {
    // Validate and sanitize input
    $itemid = mysqli_real_escape_string($conn, $_GET['id']);

    // Check if the current status is 'pending' before updating to 'confirmed'
    $check_status_query = $conn->query("SELECT status FROM nft_art WHERE itemid='$itemid'");
    $status_row = $check_status_query->fetch_assoc();

    if ($status_row && $status_row['status'] == 'pending') {
        // Update status to 'confirmed'
        $update_query = $conn->query("UPDATE nft_art SET status='confirmed' WHERE itemid='$itemid'");
        
        if ($update_query) {
            $_SESSION['msg'] = "NFT approved successfully!";
        } else {
            $_SESSION['msg'] = "Error approving NFT: " . $conn->error;
        }
    } else {
        $_SESSION['msg'] = "NFT is not in pending status or invalid Item ID.";
    }

    header("Location: " . $_SERVER['HTTP_REFERER']);
} else {
    // Redirect to an error page or handle the case where parameters are not set appropriately
    header("Location: error.php");
    exit();
}
?>
Back to Directory File Manager
<