%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64
User : ndkhermy ( 1200)
PHP Version : 8.5.12
Disable Function : NONE
Directory :  /home1/ndkhermy/www/website_6ca89795/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home1/ndkhermy/www/website_6ca89795/admin/toggle_status.php
<?php
session_start();
if (!isset($_SESSION["username"])) {
    header('location:../admin.php');
    exit;
}

include('../dbcon.php');

// Validate and sanitize inputs
$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
$status = isset($_GET['status']) ? (int)$_GET['status'] : 0;

// Check if ID is valid
if ($id <= 0 || ($status !== 0 && $status !== 1)) {
    echo "Invalid request!";
    exit;
}

// Update the status
$query = "UPDATE `offer` SET `is_active` = ? WHERE `id` = ?";
$stmt = $conn->prepare($query);
$stmt->bind_param('ii', $status, $id);

if ($stmt->execute()) {
    // Redirect back to the offer list
    header('Location: offer_list.php');
    exit;
} else {
    echo "Error updating status: " . $conn->error;
}

$stmt->close();
$conn->close();
?>

VaKeR 2022